Jump to content

$sql="select * from mytable "


rabmerab

Recommended Posts

Hi every one, :)

 

May be this is a just a basic but I am stuck.

 

I am using the sql query  $sql="select * from mytable " to try to display 4 rows but I getting  only one.

when I am using mysql command line with the same query I get all the 4 rows.

the problem only in php.

The other things like connecting to mysql and selecting the database been done.

Any help please.

Thanks in advance.

 

Rabmerab :)

 

Screen shot:

 

#connect to my sql

$conn=@mysql_connect("localhost","me","mypass") or die ("Couldn't connect");

 

 

# select database

$rs=@mysql_select_db("mydatabase",$conn)or die("could not  select database");

 

 

#Create the sql query

 

$sql="select * from mytable ";

       

# Execute query

 

$rs= mysql_query($sql,$conn);

 

 

#get the number of rows

    $num=mysql_numrows($rs);

   

    while($row= Mysql_fetch_array($rs) )

    {

    $list="<br>".$row["imei"];

  echo($list);

    }

 

?>

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/103854-sqlselect-from-mytable/
Share on other sites

Hi again,

 

I don't know how come it didn't display the error even i got display_errors in phpinfo shows it is on.

It did shows me other errors.

Any way even I change it to $num=mysql_num_rows($rs), now it shows 2 but in reality, the table has 6 rows.

I don't know what's going on. >:(

 

thanks for any more help.

 

rabmerab

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.