Right now I have 2 tables. A comment table and a user table. Short and simple, I wanna sent a comment to all users. I need to know the sql command for it and how to display on PHP.
Comment table
- pk
- comment
- sender (refers to username)
- receiver (refers to username)
User table
- pk
- username
- etc.....
I tried using this:
$provider = $_REQUEST['provider'];
$cert = $_REQUEST['cert'];
$valid = $_REQUEST['valid'];
$lprice = $_REQUEST['lprice'];
$trial = $_REQUEST['trial'];
$cost = $_REQUEST['cost'];
echo $cert;
$sql=mysql_query("SELECT * FROM sslcert WHERE CertificateName='$cert'",$connect);
if(mysql_num_rows($sql)>0)
{
echo"SSL already exists.";
echo "<br><a href=addssl.php>Back</a>";
}
else
{
$insert = mysql_query("INSERT INTO sslcert (Provider, CertificateName, Validation,
ListPrice, Trial, Cost) VALUES ('$provider', '$cert', '$valid', '$lprice',
'$trial', '$cost')",$connect);
$result77=mysql_query("SELECT username FROM user");
while($row77=mysql_fetch_array($result77))
{
$insert1 = mysql_query("INSERT INTO notification (msg, sender, receiver, notification) VALUES ('A new product is now available, $cert by $provider', '$username', '$row77['username']', 1)");
if(!$insert1){
die("There's little problem: ".mysql_error());
echo "<br><a href=quotesmanage1.php>Back</a>";
}
}
if(!$insert){
die("There's little problem: ".mysql_error());
echo "<br><a href=addssl.php>Back</a>";
}
echo "<br>You have add a new Product <br><a href=adminhome.php>Back to Home</a>";
}
mysql_close($connect);
}
the call for username is somewhere else on the page. It came out with a blank page (error on php), any ideas?