Jump to content

mysql query in php


jaiffed

Recommended Posts

is anything wrong in this syntax

 

mysql_select_db($Db, $link);

 

$limit=20; // rows to return

$numresults=mysql_query("select * from mem_master");

$numrows=mysql_num_rows($numresults);

 

// next determine if offset has been passed to script, if not use 0

if (empty($offset)) {

    $offset=0;

}

 

// get results

$result=mysql_query("select mem_id,mem_name,add1,add2,tel,mobole,email.balance".

    "from mem_master".

    "LIMIT $offset,$limit");

 

// now you can display the results returned

while ($data=mysql_fetch_array($result)) {

   

  echo '<tr>';

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['mem_id'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['mem_name'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['add1'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['add2'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['tel'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['mobile'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['email'] . "</a></td>";

    echo '<td><a href="memmodify.php?itemmem='.$row[mem_id].'">' . $row['balance'] . "</a></td>";

  echo '</tr>';

}

echo '</table>';

 

 

it get error in that line        while ($data=mysql_fetch_array($result)) {

 

please help me i think problem is in

    $result=mysql_query("select mem_id,mem_name,add1,add2,tel,mobole,email.balance".

    "from mem_master".

    "LIMIT $offset,$limit");

because $result value shows 0

Link to comment
https://forums.phpfreaks.com/topic/193711-mysql-query-in-php/
Share on other sites

What error do you get and on what line?

 

Also change this:

$result=mysql_query("select mem_id,mem_name,add1,add2,tel,mobole,email.balance".
    "from mem_master".
    "LIMIT $offset,$limit");

To this:

$result=mysql_query("select mem_id, mem_name, add1, add2, tel, mobole, email, balance".
    " from mem_master".
    " LIMIT $offset, $limit");

Maybe that would help ;)

Link to comment
https://forums.phpfreaks.com/topic/193711-mysql-query-in-php/#findComment-1019612
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.