Jump to content

Recommended Posts

I am getting these errors when I go to this page:

 

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 13

 

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 13

 

Warning: Wrong parameter count for mysql_fetch_assoc() in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 14

 

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 17

 

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 17

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 18

$horse_color

 

 

My username, password, host, and database name is filled out correctly and it works. What's my problem?

 

Thanks!

 

 

 

<?php

DEFINE ('DB_USER', 'username');
DEFINE ('DB_PASSWORD', 'password');
DEFINE ('DB_HOST', 'host');
DEFINE ('DB_NAME', 'database name');

$dbc = @mysqli_connect (DB_HOST, DB_USER, DB_PASSWORD, DB_NAME) OR die ('Could not connect to MySQL: ' .mysqli_connect_error() );

$momhorseid=2;
$dadhorseid=1;

//**********************************COLOR***********************
function getHorseColor(){


$sql = "SELECT color FROM horses WHERE horse_id=$momhorseid LIMIT 1";//limit to 1 row returned
$query = mysql_query($sql);
$row = mysql_fetch_assoc($query);
$momcolor= $row_mcolor['color'];//$momcolor now contains her color
$sql_dcolor = "SELECT color FROM horses WHERE horse_id=$dadhorseid LIMIT 1";//limit to 1 row returned
$query_dcolor = mysql_query($sql_dcolor);
$row_dcolor = mysql_fetch_assoc($query_dcolor);
$dadcolor= $row_dcolor['color'];//$dadcolor now contains his color

Ahhhh...something I did not know. Thank you!

 

Now my errors are:

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 14

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 18

Ahhhh...something I did not know. Thank you!

 

Now my errors are:

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 14

 

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/content/e/q/u/equianadmin/html/htdocs/practice.php on line 18

 

this is the same problem as before -- 'mysqli' not 'mysql'

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.