Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mysql_real_connect 1

Status
Not open for further replies.

VBRookie

Programmer
May 29, 2001
331
US
Hi,

I've been googling for probably an hour on this and have gotten no where. I'm trying to return a record set from my stored procedure but found out that I have to use CLIENT_MULTI_RESULTS to do it. So I put code in place that I found on several sites to call mysql_real_connect. This is my code:

Code:
$dbconnect = NULL;
$dbhost = "localhost:3307";
$dbname = "db";
$dbusername = "root";
$dbuserpass = "pass";

MYSQL mysql;
mysql_init(&mysql);
$dbconnect = mysql_real_connect(&mysql, $dbhost, $dbusername, $dbuserpass, $dbname, 3307, 0, CLIENT_MULTI_RESULTS);

The error that I'm getting is :
Code:
Parse error: parse error, unexpected T_VARIABLE in C:\The S Files\WebDev\DataQuest\includes\db.php on line 25

Line 25 is the following:
Code:
MYSQL mysql;

What am I doing wrong? I'm using PHP 5 and MySQL 5 and Smarty and am quite new at all three. Please help ... your help would be greatly appreciated ...

Regards,
VB Rookie
[banghead]
 
What do you expect the line:

MYSQL mysql;

to do? "MYSQL" seems to be the preface to some kind of declaration, but "mysql" is a string.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I have no idea what it should do ... that's what I've seen in all of the code postings that I found on google relating to this problem. I have no idea what it means though ...

I'd like to know so that I can figure out the problem. When I comment that line out and the mysql_init line and put Null as the first parameter for the call to mysql_real_connect then I get an error saying that mysql_real_connect is unrecognized ...

Please advise ... anybody ... I'm nearing my wit's end ...

Kindest Regards,
- VB Rookie

 
Recommendation #1. check here for the usage of mysql functions for PHP. It has a vast online manual with every function and its usage with examples placed by users.

Secondly, I could not find a function by the name mysql_real_connect, but i did however find one thats called mysql[red]i[/red]_real_connect. Maybe that's the function you want. With an "i". And that{s why its givin you an unrecognized function error.

Thirdly.
MYSLQ mysql; I{ve been working with mysql db{s and PHP for almost 10 years now, and have never found such a declarattion.


and Fourth, since your question deals mainly with PHP functions for mysql, and not directly witrh mysql, i suggest you try to post it in the PHP forum here: forum434






----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 

Thanks vacunita ... I will follow these suggestions up!

- VB Rookie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top