Jump to content

Recommended Posts

if ($free) {
$query = mysql_query("SELECT * FROM vids WHERE number='$free'") or die("cant get free vid info");
$row = mysql_fetch_array($query) or die("error with this row");
$videourlfree = $row['videourl'];
$imgurlfree = $row['imgurl'];
}

 

The code stops and displays the message: error with this row  -any ideas???

Link to comment
https://forums.phpfreaks.com/topic/77169-solved-error-with-simple-mysql-query/
Share on other sites

try and tell me if you see any errors

 

if ($free) {
$query = mysql_query("SELECT * FROM vids WHERE number='$free'") or die("cant get free vid info");
$row = mysql_fetch_array($query) or die("error with this row");
if (mysql_error()) { echo mysql_error();}
$videourlfree = $row['videourl'];
$imgurlfree = $row['imgurl'];
}

Change you code to:

<?php
if ($free) {
     $query = "SELECT * FROM vids WHERE number='$free'";
     $rs = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());
     $row = mysql_fetch_array($rs) or die("error with this row<br>" . mysql_error());
     $videourlfree = $row['videourl'];
     $imgurlfree = $row['imgurl'];
}?>

 

This will tell you what the problem is.

 

Ken

 

if ($free) {
     $query = "SELECT * FROM vids WHERE number='$free'";
     $rs = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());
     $row = mysql_fetch_array($rs) or die("error with this row<br>" . mysql_error());
     $videourlfree = $row['videourl'];
     $imgurlfree = $row['imgurl'];
}

Are you sure rows are being returned by the query?

 

Try this:

<?php
if ($free) {
     $query = "SELECT * FROM vids WHERE number='$free'";
     $rs = mysql_query($query) or die("Problem with the query: $query<br>" . mysql_error());
     if (mysql_num_rows($rs) > 0) {
         $row = mysql_fetch_array($rs);
         $videourlfree = $row['videourl'];
         $imgurlfree = $row['imgurl']; }
     else
         echo 'Problem with the query: ' . $query . '<br>No information returned from the database<br>';
}?>

 

Ken

The forums have been erroring out the last few days and people think their post didn't go through, so they post again.

 

Do not double post same topic again. I answered and closed your other one found at:

 

http://www.phpfreaks.com/forums/index.php/topic,167516.0.html

 

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.