Development Articles
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOtherDevelopment Articles

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 9th, 2000, 01:03 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Error

Nothing to say but I bet all of you see what's wrong out there.

Looking forward to Part 3 now.

Reply With Quote
  #2  
Old August 9th, 2000, 05:36 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
HTML errors in the article

Unfortunately, the article is full of HTML errors like these:
<br>
&lthtml>
<br>
<br>
This may only be visible in Netscape(?).

Reply With Quote
  #3  
Old August 10th, 2000, 04:22 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: HTML errors in the article

It's okay with MSIE. I just checked it out.
<br>
Maybe, DevShed's editors are using IE.
<br>
<br>
I wish this comments would notify the editor via email! &lt => <
<br>
<br>
However, this article is great enough to stand the HTML error.
<br>
<br>
Jaewoong

Reply With Quote
  #4  
Old August 10th, 2000, 05:38 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Good tutorial

Even though this is easy to pick up, I'm glad to see this kind of tutorial on php. I've been looking for something like this. I wonder how deep the php 101 is going to go.

Reply With Quote
  #5  
Old August 10th, 2000, 08:53 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Php 101

Thanks for an excellent article on PHP!

It is simple yet powerful.

Reply With Quote
  #6  
Old August 11th, 2000, 10:25 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
php101

good, but could have been longer


Reply With Quote
  #7  
Old August 11th, 2000, 12:55 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Good beginnings

I'm sending this article to friends who are just starting to use PHP. I've been using it for a few months, and had never thought of using the <tt>$submit</tt> var.
<br>
<br>
However, I was a bit disappointed by the explanation of the <tt>===</tt> symbol. Although I understand what it does by reading the text, I didn't really see how it was applicable in the example.
<br>
<br>
Looking forward to part 3!

Reply With Quote
  #8  
Old August 11th, 2000, 02:19 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
If "whatever" = "nothing"?

I have a problem, I am setting up a simple job opportunity section for a radio station. I am using a mySQL database. I have no problem getting the searches to work and field to display. My problem is that when there are no jobs to display, I want to display a default "check back soon" message. I have tried everything I can think of, but still cannot get it to display the message if there are no jobs. I am pasting some of the code below and will highlight with ***** the place I am working on. Thanks to any brains that can help me.


<?

# setup SQL statement
$SQL = " SELECT * FROM Opportunities WHERE Paid = 'yes'";

# execute SQL statement
$retid = mysql_db_query($db, $SQL, $cid);

# Get num of rows
$numrows = mysql_numrows($retid);

# check for errors
if (!$retid) { echo( mysql_error()); }
else {

# display results
while ($row = mysql_fetch_array($retid))
{

$title = $row["Title"];
$pay = $row["Pay_Rate"];
$desc = $row["Description"];
$skills = $row["Skills"];

***********************************
(what's below doesn't work, please help!

if ($title != "")
{ echo ("<font face=arial size=2><b>DEFAULT MESSAGE HERE!</b></font>"); }

***********************************

if ($title > "")
{ echo ("<table cellpadding=0 cellspacing=0 border=0>
<tr><td valign=top align=right>
<font face=arial size=2><b>Title:&nbsp;&nbsp;</b></font>
</td><td valign=top>
<font face=arial size=3><b>$title</b></font>
</td></tr> \n"); }

if ($pay > "")
{ echo ("<tr><td valign=top align=right>
<font face=arial size=2><b>Pay:&nbsp;&nbsp;</b></font>
</td><td valign=top>
<font face=arial size=2>$pay</font>
</td></tr> \n"); }

etc. etc..

Thanks,
Mike

Reply With Quote
  #9  
Old August 11th, 2000, 03:04 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: If

This may seem too simple, but I don't know if I know what you're asking:

if (!empty($title)) {
print "Title:&nbsp;&nbsp; $title <BR>\n";
}
if (!empty($pay)) {
print "Pay:&nbsp;&nbsp; $pay <BR>\n");
}

Reply With Quote
  #10  
Old August 11th, 2000, 03:25 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: If

Thanks, but that isn't it. I have got it to work if it is not empty, the problem comes when there are no jobs. I can do what you did with *** if ($title > "") { echo... *** and it works perfectly, however if there are no jobs in the database, I can't make it display a default "Sorry nothing available" type message. I thought of ***if ($title = "") { echo... *** , (meaning equal to nothing) but it didn't work. I have also tried a multitude of other "not equal to" type language, but it still will not display the message.
<br>
<br>
I am wondering if there is some syntax that I either don't have or do have previously in the script that could be nullifying this function somehow.
<br>
<br>
Mike

Reply With Quote
  #11  
Old August 11th, 2000, 03:38 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: If

Ok, ok, ok....

you said: if ($title = "")

that would always be true!

you should say: if ($title == "")

You need to display more of your program. Go back a couple steps. You are getting the data from a mySQL database. something like this:

$sql = "SELECT * FROM tablename";
$result = mysql_query($sql);
if ($result && $num = mysql_num_rows($result)) {
// display your results
}
else {
// display your error message of none to see
}

Reply With Quote
  #12  
Old August 11th, 2000, 03:45 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: If

I may have said that a little too quick in the last message.

Let me clarify. Use the function mysql_num_rows() to see if there are results or not. Here is another way to accomplish the same thing:

$sql = "SELECT * FROM tablename"; $result = mysql_query($sql); if ($result) { if (mysql_num_rows($result) > 0) { // display your results } else { // display your error message of none to see } } else { // could not query the database for some reason or another. }

Reply With Quote
  #13  
Old August 11th, 2000, 04:02 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: If

Yes, that worked. I am extremely grateful for your help. I had tried about everything, and of course the answer was actually quite simple to implement as usual.

Mike

Reply With Quote
  #14  
Old August 11th, 2000, 10:38 PM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
This is great stuff!

I have read several php books and felt that I was still missing a few basics. This is filling in those gaps.

Thanks!!!!
Mel

Reply With Quote
  #15  
Old August 12th, 2000, 07:46 AM
guest
Guest
Dev Shed Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
Re: HTML errors in the article

Someone fixed the HTML errors. Thanks for that.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOtherDevelopment Articles > PHP 101 (Part 2) - Shakespeare's Rose


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway