Re: Why doesn't this work?
| From: | Joel | Date: | Fri, 27 Jul 2001 21:15:40 +0000 |
| Subject: | Re: Why doesn't this work? | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-8540@lists.php.net to get a copy of this message | ||
Hi Ivan and the others,
I realized my mistake, it was a slight confusion.
Actually no function like mysql_result exists. It was mysql_query
and I mistook it for mysql_result. The script works now and can
successfully create the tables, the script below now works :
<?php
$db = mysql_connect("localhost","myusername","mypass");
mysql_select_db("mydatabase",$db);
$sql = "CREATE TABLE computers (Email TEXT not null , Username TEXT not null , Password TEXT
not null )";
mysql_query($sql,$db); //Now it works because it was not mysql_result
echo "<B>DONE!</B>";
?>
Thanks anyway, you could do so many functions that phpMyAdmin does
when you wanted your PHP script to automatically do that using the above
code snip.
Ivan, I think you've not configured PHP properly on your windows system if the
above script doesn't run (after you've created a database called mydatabase).
Joel Agnel.
--------
Sign up for our Free Weekly Newsletter that delivers
Cool Sites directly to you by e-mail. You'll have Fun!
Click Here : http://www.siteskool.com/sites/
--------
"Ivan Milanez Castellanos" <imilanez@segob.gob.mx> wrote in message news:000a01c116c3$86404fc0$4e2a10ac@intra002...
Joel: I had the same problem you did, the script isn't wrong it's just
that even though the PHP manual says to use the sintax you used, the
actual sintax for mysql_select_db and for mysql_query or mysql_result
is:
mysql_select_db(string db_name)
mysql_query(string query_string)
mysql_result(string query_string)
At least that's how it worked for me.
Later.
Iván
-----Mensaje original-----
De: Joel [mailto:3lnt-i0fe@spamex.com]
Enviado el: Viernes, 27 de Julio de 2001 01:08 p.m.
Para: php-windows@lists.php.net
Asunto: [PHP-WIN] Why doesn't this work?
I'm trying to create table in a database using PHP with MySQL. I want
the script to do it on its own, I tried but couldn't get it to work. The
script is below : <?php $db =
mysql_connect("localhost","myusername","mypass");
mysql_select_db("sitesko2",$db);
$sql = "CREATE TABLE computers (Email TEXT not null , Username TEXT not
null , Password TEXT not null )"; mysql_result($sql,$db); echo
"<B>DONE!</B>"; ?>
Please let me know whats going wrong in that.
Thanks,
--
Joel Agnel.
joelagnel@spamex.com
--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
For additional commands, e-mail: php-windows-help@lists.php.net To
contact the list administrators, e-mail: php-list-admin@lists.php.net