Notices

Water Fountain General Chit/Chat

Reply
 
LinkBack Thread Tools
Old 07-26-05, 11:45 PM   #1 (permalink)
Aximsite Elite
 
joedoe101's Avatar
Uber Member
 
Join Date: Dec 2003
Location: Colorado
Posts: 2,862
Thanked 0 Times in 0 Posts
PHP help

Hi guys, i am a total n00b to php...just started learning 5 hours ago ;)

Well, here is what i have for an update...It is for an acp so i will post the settings page, and the page that is supposed to update the sql...Please help me if you can... :D

Settings page...
Code:
<?
include("../config.php");
mysql_connect($dbhost, $dbusername, $dbpasswd);

mysql_select_db("traffic_traffic");
?>
<html>
<head>
<style type="text/css">
body {
	margin-top: 0px;
	margin-left: 5px;
	margin-right: 5px;
	font-family: Trebuchet MS;
	color: #000099;
	background-color: #D5DFED;
	font-size: 10pt;
}
table {
   border-collapse: collapse;
}
table td {
   border: 1px solid #808080;
}
</style>
</head>
<body>
<center><img src="admin.gif" border="0"></center><br />
<center>
<table border="1">
<tr>
<td>
<?
if($a == "update") {
	$sql = "UPDATE `config` SET `config_value`='".$newratio."', `Timer`='".$timer."', `config_value[Status]`='".$status."', `Allow Register`='".$allow_register."'";
	mysql_query($sql) or die(mysql_error());
	?>
	<center>Updated!</center>
	<?
}
$sql = "SELECT config_name, config_value FROM config";
$sqlr = mysql_query($sql) or die(mysql_error()."Error at mysql_query");
$sr = mysql_fetch_array($sqlr) or die(mysql_error()."Error at mysql_fetch_array");
?>

<form method="post" action="create.php">
<font color="000099" face="Trebuchet MS">
----------------------</br>
Credits Given</br>
----------------------</BR>
Credits per join:
<input type="text" name="cpj">
</BR></BR>
Credits per referral:
<input type="text" name="cpr">
</BR></BR>
Percent of referals credit given to referrer:
<input type="text" name="prc">
</BR></BR>
Credits per surf:
<input type="text" name="cps">
</BR></BR>
----------------------</br>
Site Config</br>
----------------------</BR>
Site status:
Enabled<input type="radio" name="status" value="Enabled">
Disabled<input type="radio" name="status" value="Disabled">
</BR></BR>
Allow registering
Yes<input type="radio" name="register" value="yes">
No<input type="radio" name="register" value="no">
</BR></BR>
Surfs per day:
<input type="text" name="spd">
</BR></BR>
----------------------</br>
User config</br>
----------------------</BR>
Amount of sites:
<input type="text" name="sites">
</BR></BR>
----------------------</br>
Email config</br>
----------------------</BR>
Email address:
<input type="text" name="email">
</BR></BR>
Email signature:
<input type="text" name="emailsig">
</BR></BR>
Email upon join:
Yes<input type="radio" checked name="register" value="yes">
No<input type="radio" name="register" value="no">
</BR></BR>
Content of email:</br>
<textarea name="emailcontent" rows="5" cols="30" wrap=virtual"></textarea>
<br /><br />
<input type="submit" value="Submit Changes"> <input type="reset" value="Reset Form">
</form>
</font>
</body>
</html>

Update page
Code:
<?
$sql = "UPDATE INTO config (config_cjp, config_cpr, config_cps, config_prc, config_sites, config_spd, config_email, config_emailsig, config_register, config_emailcontent)
VALUES ('_POST[config_cjp]', VALUES ('_POST[config_cpr]', VALUES ('_POST[config_cps]', VALUES ('_POST[config_prc]', VALUES ('_POST[config_sites]', VALUES ('_POST[config_spd]', VALUES ('_POST[config_email]', VALUES ('_POST[config_emailsig]', VALUES ('_POST[config_register]', VALUES ('_POST[config_emailcontent]')";

$conn = mysql_connect("localhost","**EDITED OUT**","**EDITED OUT**") or die (mysql_error())";

$db = mysql_select_db("traffic", $conn) or die (mysql_error())";

if ($sql_result) {
echo "
<p>Updated</p>";
}
?>
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
joedoe101 is offline   Reply With Quote
Sponsor Ads
Old 07-27-05, 01:49 AM   #2 (permalink)
Aximsite All Star
 
transcout's Avatar
Elite Member
 
Join Date: Sep 2004
Location: UK
Posts: 975
Thanked 0 Times in 0 Posts
i don't understand what you need help with - does it not work?
transcout is offline   Reply With Quote
Old 07-27-05, 01:54 AM   #3 (permalink)
Aximsite Elite
 
joedoe101's Avatar
Uber Member
 
Join Date: Dec 2003
Location: Colorado
Posts: 2,862
Thanked 0 Times in 0 Posts
Yes, says I have an error on the second one on line 5...Says unexpected \ when there isnt even one on that line.
joedoe101 is offline   Reply With Quote
Old 07-27-05, 03:26 AM   #4 (permalink)
Aximsite All Star
 
transcout's Avatar
Elite Member
 
Join Date: Sep 2004
Location: UK
Posts: 975
Thanked 0 Times in 0 Posts
Change the second page to:
Code:
<?
$sql = "UPDATE INTO config (config_cjp, config_cpr, config_cps, config_prc, config_sites, config_spd, config_email, config_emailsig, config_register, config_emailcontent)
VALUES ('_POST[config_cjp]', VALUES ('_POST[config_cpr]', VALUES ('_POST[config_cps]', VALUES ('_POST[config_prc]', VALUES ('_POST[config_sites]', VALUES ('_POST[config_spd]', VALUES ('_POST[config_email]', VALUES ('_POST[config_emailsig]', VALUES ('_POST[config_register]', VALUES ('_POST[config_emailcontent]')";

$conn = mysql_connect("localhost","**EDITED OUT**","**EDITED OUT**") or die (mysql_error());

$db = mysql_select_db("traffic", $conn) or die (mysql_error());

if ($sql_result)
echo ("<p>Updated</p>");
?>
You put two "'s where there shouldn't have been.
transcout is offline   Reply With Quote
Old 07-27-05, 03:50 AM   #5 (permalink)
Aximsite Elite
 
joedoe101's Avatar
Uber Member
 
Join Date: Dec 2003
Location: Colorado
Posts: 2,862
Thanked 0 Times in 0 Posts
I get an error now that says access denied for my user...do i need to define my username and pass?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
joedoe101 is offline   Reply With Quote
Old 07-27-05, 09:17 AM   #6 (permalink)
Aximsite Major League
 
Kamokazi's Avatar
Senior Member
 
Join Date: May 2005
Location: West-Central Ohio
Posts: 450
Device: Motorola v710
Carrier: Verizon
Thanked 0 Times in 0 Posts
The SQL dbase prolly needs a user and pass setup. Pretty sure that's what I had to do when I setup my EQ guild's phpNuke site. Been a while, haven't really done much with it since.
__________________
Axim X50v
WM 2003 SE
1GB Sandisk Ultra II SD Card
1GB Sandisk Ultra II SD Plus USB Card
Innopocket Magnesium Case
Think Outside BlueTooth Keyboard & Mouse
SONY MD-EX71SL Earbuds

Axim X5 Advanced
DELL TrueMobile Wifi CF Card
Socket BlueTooth CF Card
Rhinoskin Aluminum Case

and Apps > Sig space...
Kamokazi is offline   Reply With Quote
Old 07-27-05, 01:42 PM   #7 (permalink)
Aximsite All Star
 
transcout's Avatar
Elite Member
 
Join Date: Sep 2004
Location: UK
Posts: 975
Thanked 0 Times in 0 Posts
Did you change the **EDITED OUT** in my post back to the real values or did you just copy and paste? Incidentaly, you might want to just the SQL connection and Session_start stuff in an 'include.inc' and just put 'include("include.inc");' at the start of each file. That way, you only have to change 1 file if you need to change database or something.
transcout is offline   Reply With Quote
Reply

Tags
php

Sponsor Ads

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 01:28 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Copyright © 2003-09 LeckMedia, LLC