Connecting my script

NamecheapNamecheap
Watch

russia5

New Member
Impact
0
Hello,

I am trying to install this code:

<?php
mysql_connect("localhost", "russia5_Greg", "pasadena1") or die(mysql_error());
echo "Connected to MySQL<br />";
mysql_select_db("russia5_profiles") or die(mysql_error());
or die(mysql_error());
$rows_per_page = 3;
$sql = "SELECT * FROM Profile_delivery";
$result = mysql_query($sql, $db);
$total_records = mysql_num_rows($result);
$pages = ceil($total_records / $rows_per_page);
mysql_free_result($result);
?>

and I am getting this error.


Parse error: parse error in /home/russia5/public_html/index_Greg6.php on line 107


Can someone tell me what my problem is?

Greg
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
*blush* You're showing up your username and password in that code!

It's hard to say, first off there seems to be an error on line 107 and your script obviously doesn't have as many lines of code. What I mean is, if this snippet is part of a script, the error might lie elsewher. Otherwise...

There's something wrong in this line

$result = mysql_query($sql, $db);

since you had not declared $db previously. In any case, this is optional so you should be fine with:

$result = mysql_query($sql);
 
0
•••
which line is 107 reason i ask is, usually the database connection is done at beginning, so that usually wouldnt be onl ine 107
 
0
•••
Another one I just spotted.

This is correct:

mysql_select_db("russia5_profiles") or die(mysql_error());

instead of

mysql_select_db("russia5_profiles") or die(mysql_error());
or die(mysql_error());

Note it was initially repeated.
 
0
•••
Dynadot — .com TransferDynadot — .com Transfer
Appraise.net

We're social

Escrow.com
Spaceship
Rexus Domain
CryptoExchange.com
Domain Recover
CatchDoms
NameMaxi - Your Domain Has Buyers
DomDB
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back