Board index   FAQ   Search  
Register  Login
Board index php forum :: Database mySQL & php coding

php and mysql

Codes here !

Moderators: macek, egami, gesf

php and mysql

Postby Omgzr » Sun Jul 22, 2012 11:23 am

Hey, am trying to make a query that shows me all the mails registered into my database.
My database name is registros
My table name is ingreso
The var for mail is called correo in my program

I tried that but is not working for me, if you guys can help me to find the mistake I would appreciate it

<body bgcolor="black">



<h1 align="center" class="Estilo1"><font face="bell mt cursiva" color="darkred" size="12">
<font face="bell mt cursiva" color="darkred" size="12"> <marquee bgcolor="black">Usuarios registrados en la base de datos</marquee></font>
<center><img src="iupsm.jpg" style="border:15px solid#333300" width="397" height="268"></center>

echo "No Se Pudo Conectar";

echo '<h2>Usuarios registrados:</h2>';

$sql = "SELECT correo FROM ingreso";

// run the query. Will return a resource or false
$result = mysql_query($sql);

// if it ran OK
if ($result) {
// while I have more results, loop through them
// returning each result as an array
while ($user = mysql_fetch_array($result)) {
// use the array keys (column names) to output the data
echo $ingreso['correo'], '<br />';
New php-forum User
New php-forum User
Posts: 1
Joined: Sun Jul 22, 2012 11:15 am

Re: php and mysql

Postby Odie2828 » Mon Jul 23, 2012 3:44 am

Code: Select all
echo $ingreso['correo'], '<br />';

should read

Code: Select all
echo $user['correo']. '<br />';
New php-forum User
New php-forum User
Posts: 19
Joined: Mon Jul 23, 2012 3:14 am

Return to mySQL & php coding

Who is online

Users browsing this forum: No registered users and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.