I need smart people..

posts from hell

New Member
Joined
Nov 30, 2004
Messages
9,371
Reaction score
6
To lmk if there is anything wrong in this code?

Code:
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo "$sql users on the mailing list"
?>
 
Yeah, that's right, looks good....:io: :lol:

Just keeping it bumped up for ya!
 
Code:
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo $sql." users on the mailing list";
?>

there I fix it....... I think :dunno2:
 
lol, no need for the semicolon for echo. I did it both ways and still same issue.

and the variables should be in quotations as well.
 
With jiros code, my code, and my code with the semicolon after the echo command.... i still get this showing on the webpage.

Code:
1000"; echo $sql." users on the mailing list"; ?>
 
was a period after the $sql not supposed to be there, no?
 
oh yea.... there I fix it..... I think... :dunno2:

Code:
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

[B]mysql_select_db([COLOR="Red"]"NAME_OF_DATABASE"[/COLOR], $con);[/B]
$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo "$sql users on the mailing list"
?>
 
oh yea.... there I fix it..... I think... :dunno2:

Code:
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

[B]mysql_select_db([COLOR="Red"]"NAME_OF_DATABASE"[/COLOR], $con);[/B]
$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo "$sql users on the mailing list"
?>

This is exactly what i got:
Code:
1000"; echo "$sql users on the mailing list" ?>
 
Not sure if this would help, but -

In this example, a connection is made to the database using the user called "username", with a passsword of "password". You will want to use a unique password. The name "localhost" is used to specify that the database is on the same server that the PHP program is running on. This is your webserver. The handle to the database is returned in the variable "$chandle". If the call fails, the string contained after the "or die" part of the statement will be executed and program execution will stop.

Code:
$dbuser="username";$dbpass="password";$dbname="mydata"; //the name of the database[B]$chandle = mysql_connect("localhost", $dbuser, $dbpass) or die("Connection Failure to Database");[/B]echo "Connected to database server<br>";mysql_select_db($dbname, $chandle) or die ($dbname . " Database not found." . $dbuser);echo "Database " . $database . " is selected";mysql_close($chandle);
 
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
1240325175_roflbrothel.gif

}

$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo "$sql users on the mailing list"
?>

There I fixed it.
 
<?php
$con = mysql_connect("localhost","name","*password*");
if (!$con)
{
die('Could not connect: ' . mysql_error());
1240325175_roflbrothel.gif

}

$sql = "SELECT value FROM `phplist_userstats` WHERE value > 1000";
echo "$sql users on the mailing list"
?>

There I fixed it.
:laugh2:
 
Back
Top