> [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
[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!\
:) 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
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
> 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
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
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
[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
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
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
10 matches
Mail list logo