Defining A Varible
Moderator: General Moderators
-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
I have the code, but what do you mean by schema of news_news????
I was trying to add email into the cookie so that it will read it from the cookie, but it doesn't want to load the email from news_users.
I was trying to add email into the cookie so that it will read it from the cookie, but it doesn't want to load the email from news_users.
Code: Select all
$result = mysql_query($sql)
or die ("Can't execute query.");
$num = mysql_numrows($result);
$email = $resultї"email"];
if ($num != 0) {
$cookie_name_auth = "status";
$cookie_value_auth = "ok";
$cookie_expire_auth = 0;
$cookie_domain_auth = ".bve.32k.org";
setcookie($cookie_name_auth, $cookie_value_auth, $cookie_expire_auth, "/" , $cookie_domain_auth, 0);
$cookie_name_user = "user";
$cookie_value_user = "$username";
$cookie_expire_user = time()+86400;
$cookie_domain_user = ".bve.32k.org";
setcookie($cookie_name_user, $cookie_value_user, $cookie_expire_user, "/" , $cookie_domain_user, 0);
$cookie_name_email = "email";
$cookie_value_email = "$email";
$cookie_expire_email = time()+86400;
$cookie_domain_email = ".bve.32k.org";
setcookie($cookie_name_email, $cookie_value_email, $cookie_expire_email, "/" , $cookie_domain_email, 0);first off, this chunk of code
should be
when doing a query you need to run the query, then need to extract the data from the result object.
a schema is the layout of the table in the mysql database.
Code: Select all
$result = mysql_query($sql)
or die ("Can't execute query.");
$num = mysql_numrows($result);
$email = $result["email"];Code: Select all
$result = mysql_query($sql)
or die ("Can't execute query.");
$num = mysql_num_rows($result);
$result = mysql_fetch_array($result);
$email = $result["email"];a schema is the layout of the table in the mysql database.
-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
Code: Select all
<?php
require("news_connect.php");
if(@$action=="submit")
{
if ((!$news_headline) || (!$news_news) || (!$news_link)) {
echo "Please fill in all fields<br>\n";
} else {
mysql_query("INSERT INTO news_news (headline,news,link,user,timestamp,email) VALUES ('$news_headline','$news_news','$news_link','$user','$email',".time().")");
echo "News added<br>\n";
}}
?>-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan
Ok, I changed it to
and it still isn't adding anything into the email table.It is just being left blank.
Code: Select all
mysql_query("INSERT INTO news_news (headline,news,link,user,timestamp,email) VALUES ('$news_headline','$news_news','$news_link','$user',".time()."),'$email'");Code: Select all
mysql_query("INSERT INTO news_news (headline,news,link,user,timestamp,email) VALUES ('$news_headline','$news_news','$news_link','$user',".time().",'$email')");-
kkurkowski
- Forum Commoner
- Posts: 53
- Joined: Mon Dec 09, 2002 4:44 pm
- Location: Michigan