RE: [PHP] If you ever had a Vic20

2003-08-18 Thread Martin Towell
> [snip] > $found = 0; > while ($mydata = mysql_fetch_object($news)) > { > if ($mydata->StudentId == $StudentId) > {$found = 1; break;} > } > > if ($found==1){do this}else{do that} > [/snip] > > Why two if's? Isn't if the student

RE: [PHP] If you ever had a Vic20

2003-08-18 Thread Jay Blanchard
[snip] :) Tried that: [/snip] Let's be more verbose and see what happens if(!($myconnection = mysql_pconnect($server,$user,$pass))){ print("Failed to connect to database!\n"); exit(); } if(!mysql_select_db($db,$myconnection)){ print("Failed to select database!\

Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
:) Tried that: Warning: Supplied argument is not a valid MySQL result resource in /.../testals.php on line 189 189> if (mysql_num_rows($news) == 1) John > Matt> mysql_num_rows($news) $server = "localhost"; $user = ""; $pass = ""; $db = "redwards"; $table = "testals"; $myconnection = m

Re: [PHP] If you ever had a Vic20

2003-08-15 Thread Matt Babineau
mysql_num_rows($news) On Fri, 2003-08-15 at 17:42, John Taylor-Johnston wrote: > OK, > I tried this, but am getting this error: > Warning: Wrong parameter count for mysql_num_rows() in /.../testals.php on line 189 > 189> if (mysql_num_rows() == 1) > What's up? > John > > $myconnection = mysql_co

Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
> I had a Vic20 sitting next to a Lisa... :) The debate in them days was whether a timex-simplex would outlast. Commodore sold a lot but never went anywhere past high school labs. I knew a guy with a PC who laughed at every else. Funny how things turned out. -- PHP General Mailing List (http

Re: [PHP] If you ever had a Vic20

2003-08-15 Thread John Taylor-Johnston
OK, I tried this, but am getting this error: Warning: Wrong parameter count for mysql_num_rows() in /.../testals.php on line 189 189> if (mysql_num_rows() == 1) What's up? John $myconnection = mysql_connect($server,$user,$pass); mysql_select_db($db,$myconnection); $news = mysql_query("select Stu

RE: [PHP] If you ever had a Vic20

2003-08-15 Thread Dave Restall - System Administrator
Hi, > $found =3D 0; > while ($mydata =3D mysql_fetch_object($news)) > { > if ($mydata->StudentId =3D=3D $StudentId) > {$found =3D 1; break;} > } > > if ($found=3D=3D1){do this}else{do that} Why not re-oganise your SQL statement s

RE: [PHP] If you ever had a Vic20

2003-08-15 Thread Jay Blanchard
[snip] $found = 0; while ($mydata = mysql_fetch_object($news)) { if ($mydata->StudentId == $StudentId) {$found = 1; break;} } if ($found==1){do this}else{do that} [/snip] Why two if's? Isn't if the student is found i

RE: [PHP] If you ever had a Vic20

2003-08-15 Thread Martin Towell
Re: [PHP] If you ever had a Vic20 Ok ... so I can do it this way (below), but there must be a more intelligent way? This is like something I did with my Vic20, 19 years ago. (If you ever had a Vic20 ... :) you might sympathise) while ($mydata = mysql_fetch_object($news)) { if ($mydata->Studen

Re: [PHP] If you ever had a Vic20

2003-08-14 Thread John Taylor-Johnston
Ok ... so I can do it this way (below), but there must be a more intelligent way? This is like something I did with my Vic20, 19 years ago. (If you ever had a Vic20 ... :) you might sympathise) while ($mydata = mysql_fetch_object($news)) { if ($mydata->StudentId = $StudentId) {$found =1}else{$fo