Web Hosting Forum | Lunarpages


*
Welcome, Guest. Please login or register.
Did you miss your activation email?



Login with username, password and session length
May 24, 2012, 03:17:30 AM

Pages: [1]   Go Down
  Print  
Author Topic: Question about MySql setup  (Read 210 times)
scottjb78
Spacescooter Operator
*****
Offline Offline

Posts: 33


WWW
« on: March 27, 2003, 06:08:00 AM »

I have setup a username and password with mysql admin, along with a database.
The names follow the format  yourwe2_xxxx(database, username)

My question is when I load a php script on my site, and fill in all the configurations referencing the database. I get all kind of connections errors. Are there any other configurations or passwords I am missing here? Below is the error message I recieve. Thanks again for any help  "[Smile]"

error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/yourwe2/public_html/special.php on line 10
Logged
TWebMan
Quantum Encyclopedia Writer
*****
Offline Offline

Posts: 3112



WWW
« Reply #1 on: March 27, 2003, 08:30:00 AM »

There's some basic phpMysql info at:
http://twebman.lunarpages.com/php/

Create a table for your Mysql database "on-the-fly" at:
http://twebman.lunarpages.com/php/tablemaker.php

A typical php connection looks like this:
$dbcnx = @mysql_connect("localhost","USER NAME", "PASSWORD");
mysql_select_db("DATABASE NAME");
Now the query..

$myquery = "SELECT * FROM tablename WHERE columname = '$variablename'"; (doesn't have to be a variable, could be a value)

$myresult = (mysql_fetch_array($rmyquery)) Notice the variable name of the query in the parentheses.  That's important.

the "$dbcnx", "$myquery" and "$myresult" are arbitrary variable names. You can use whatever you like there.  Just make sure to name your query in the parenthesis of mysql_fetch_array.
 
 [ March 27, 2003, 04:40 PM: Message edited by: TWebMan ]
Logged

"Computers cause people to make more mistakes than any other invention in history, with the possible exception of handguns and tequila."  - Unknown
"Liberty of any kind is seldom lost all at once." - D. Hume
Every day is an Ode to Joy
The planet will be fine... and so will your site
Pages: [1]   Go Up
  Print  
 
Jump to: