Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,158,199 members, 7,835,973 topics. Date: Tuesday, 21 May 2024 at 06:32 PM

Hello, Pls I Need Your Help On This PHP Problem - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Hello, Pls I Need Your Help On This PHP Problem (741 Views)

Pls Help Me With This Php Code / Help With This Php Code. / I Need Help With This Php Code For Email And Sms Autoresponse (2) (3) (4)

(1) (Reply) (Go Down)

Hello, Pls I Need Your Help On This PHP Problem by OCTAVO: 11:18pm On Aug 01, 2013
I'm trying to output data from my data base but all to no avail. I have checked my codes over and over again. Pls is there anything I'm doing wrong? My coding goes thus:

<?php

mysql_connect("localhost", "root", "" ) or die("We couldn't connect!" );

mysql_select_db("testsite" );

$result = mysql_query("INSERT * FROM users" );

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

echo $row['name']." ".$row['email']." ".$row['password'];

echo "<br />";

}

mysql_close();


?>


Here is the error message I'm getting on my browser:

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\testsite\output.php on line 10

Line 10 is where I have my while loop accoding to the error message above.

Thanks
Re: Hello, Pls I Need Your Help On This PHP Problem by CODEEATER(m): 11:30pm On Aug 01, 2013
OCTAVO: I'm trying to output data from my data base but all to no avail. I have checked my codes over and over again. Pls is there anything I'm doing wrong? My coding goes thus:

<?php

mysql_connect("localhost", "root", "" ) or die("We couldn't connect!" );

mysql_select_db("testsite" );

$result = mysql_query("INSERT * FROM users" );

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

echo $row['name']." ".$row['email']." ".$row['password'];

echo "<br />";

}

mysql_close();


?>


Here is the error message I'm getting on my browser:

Parse error: syntax error, unexpected '[' in C:\xampp\htdocs\testsite\output.php on line 10

Line 10 is where I have my while loop accoding to the error message above.

Thanks

Personaly I hate concatenation In echo statmnts, so frst of all,I sujest u chng d code to sumtin lyk

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

echo "{$row['name']} {$row['email']} {$row['password']}";



try dis frst,let's c
Re: Hello, Pls I Need Your Help On This PHP Problem by OCTAVO: 11:34pm On Aug 01, 2013
CODE-EATER:


Personaly I hate concatenation In echo statmnts, so frst of all,I sujest u chng d code to sumtin lyk

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

echo "{$row['name']} {$row['email']} {$row['password']}";



try dis fast,let's c
Ok, thanks my Oga. Lemme try.
Re: Hello, Pls I Need Your Help On This PHP Problem by CODEEATER(m): 11:40pm On Aug 01, 2013
OCTAVO:
Ok, thanks my Oga. Lemme try.
DNT 4get to close d while statement oo
Re: Hello, Pls I Need Your Help On This PHP Problem by OCTAVO: 11:42pm On Aug 01, 2013
It didn't work.
Got this error message:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\testsite\output.php on line 10
Re: Hello, Pls I Need Your Help On This PHP Problem by spikesC(m): 11:45pm On Aug 01, 2013
Abeg, is it INSERT * OR SELECT *
Re: Hello, Pls I Need Your Help On This PHP Problem by CODEEATER(m): 11:48pm On Aug 01, 2013
spikes C: Abeg, is it INSERT * OR SELECT *
Mtcheww, I no even c dat 1....select jor
Re: Hello, Pls I Need Your Help On This PHP Problem by OCTAVO: 11:52pm On Aug 01, 2013
Thank you guys cheesy
I don see my mistake. It is supposed to be SELECT. Thank you once again.

(1) (Reply)

Ghana's Number 1 App Launched / Who Is Good In Google-app-engine / Help On Php Form

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.