premiso
Members-
Posts
6,951 -
Joined
-
Last visited
-
Days Won
2
Everything posted by premiso
-
[SOLVED] colllecting unknown varial names and changing them
premiso replied to shadiadiph's topic in PHP Coding Help
echo '<tr><td><input type="checkbox" name="news[]" value="'. $mtitle. '" /></td><td width="90% align="left">'. $mtitle. '</td></tr>'; $i++; } That will put it in an array and $HTTP_POST_VARS is depreciated, use $_POST instead. This will return an array of news items, so $_POST['news'][0] will give you the first item etc. -
[SOLVED] How to check if a value is above a certain number
premiso replied to Alecdude's topic in PHP Coding Help
ummm assuming you've retrieved the value from sql... if ($row['yourrowcheckhere'] > 15) { // execute function here. } -
Even if you do encode it, it can be decoded if someone really wants your script. Sad but true, imo it is not worth the money to encode it with Zend or any other pay per, unless you script is amazingly high priced and high demand.
-
$start = strtotime($startyear ."-". $startmonth ."-". $startday); $finish = strtotime($finishyear ."-". $finishmonth ."-". $finishday); You have to use concatenation properly.
-
header Tells you all you need to know.
-
[SOLVED] insert data into 3 tables at the same time
premiso replied to B34ST's topic in PHP Coding Help
<?php $query1 = mysql_query("INSERT INTO table1 (field1,field2,field3) values ($value1,$value2,$value3)"); $lastId = mysql_insert_id(); $query2 = mysql_query("INSERT INTO table2 (autoIdField,field4,field5,field6) values ($lastId,$field4,$field5)"); $query3 = mysql_query("INSERT INTO table3 (autoIdField,field7,field8,field9) values ($lastId, $field7,$field8,$field9)"); ?> You need to also run mysql_query -
<?php $ip = $_SERVER['REMOTE_ADDR']; Will give you the ip address.
-
You are still using singlequotes ' not backticks ` There is a difference. ` is to the right of the 1 key, above the tab key and below the esc key. The other is next to the ; key and the enter key.
-
mysql_query("INSERT INTO requests (name, email, `desc`) VALUES ('$name', '$email', '$desc')"); Back tcks ` are to the left of the one.
-
You have to remove the spaces in the tag, since it parses them I had to space them out.
-
[ code] Post code here. [ /code] But since I cannot show you the actual tag, remove the first space before code and /code. Then just paste your form.
-
The reason we use the [ code ] [ /code ] tags is that we do not have to scroll forever just to look at the code. Please do this from now on. <?php /* subject and email variables */ $emailSubject = 'Feedback from Telemika.com'; $webMaster = 'erikaphoto@gmail.com'; /* Gathering Data Variables */ $emailField = $_POST['email']; $subscribeField = $_POST['subscribe']; $unsubscribeField = $_POST['unsubscribe']; $nameField = $_POST['name']; $feedbackField = $_POST['feedback']; $body = <<<EOD <br><hr><br> Email: $email <br> Name: $name <br> Subscribe: $subscribe <br> Unsubscribe: $unsubscribe <br> Feedback: $feedback <br> EOD; $headers = "From: $email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail($webMaster, $emailSubject, $body, $headers); /* Results rendered as HTML */ $theResults = <<<EOD <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Thanks!</title> <style type="text/css"> <!-- body { font: 100% Verdana, Arial, Helvetica, sans-serif; background: #666666; margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */ padding: 0; text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */ color: #000000; background-color: #000000; } .contact { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #484848; text-decoration: none; font-weight: normal; letter-spacing: 1px; } .art { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FF3399; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .artroll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .multimedia { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #9933FF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .multimediaroll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .work { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #00CC00; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .workroll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .news { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFF00; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .newsroll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .bio { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FF3300; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .bioroll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .shop { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #00CCFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .shoproll { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF; text-decoration: none; font-weight: bold; letter-spacing: 1px; padding-bottom: 5px; } .oneColFixCtrHdr #container { width: 960px; margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */ border: 1px solid #000000; text-align: left; /* this overrides the text-align: center on the body element. */ } a:link { text-decoration: none; } a:visited { text-decoration: none; } a:hover { text-decoration: none; } a:active { text-decoration: none; } .newstext { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFF00; text-decoration: none; letter-spacing: 1px; padding-top: 2px; padding-right: 5px; padding-bottom: 5px; padding-left: 10px; border-top-color: #A6A6A6; } .newsframe { border: 1px dotted #00CC00; } .worktext {color: #009933} .style1 {color: #009933; font-weight: bold; } .style3 {color: #009933; font-size: 12px; } --> </style> </head> <body class="oneColFixCtrHdr"> <div id="container"> <div id="header"> <table width="718" height="580" align="center"> <tr> <td width="710" height="14"><div align="center" class="contact"> <p><a href="mailto:erikaphoto@gmail.com" class="contact">Erika T. Bergère | Photography & Multimedia | erikaphoto@gmail.com | +44(0)7910122945</a></p> </div></td> </tr> <tr> <td height="33"><table width="706" height="27" border="0" align="center" bgcolor="#000000" class="menu"> <tr> <td width="107" height="23" class="art"><div align="center" class="art"><a href="art.html" class="art">Art</a></div></td> <td width="139" height="23" class="work"><div align="center" class="multimedia"><a href="multimedia.html" class="multimedia">Multimedia</a></div></td> <td width="122" height="23" class="news"><div align="center" class="work"><a href="work.html" class="work">Work</a></div></td> <td width="116" height="23" class="shop"><div align="center" class="news"><a href="news.html" class="news">News</a></div></td> <td width="98" height="23" class="bio"><div align="center" class="bio"><a href="bio.html" class="bio">Bio</a></div></td> <td width="98" class="bio"><div align="center" class="shop"><a href="shop.html" class="shop">Shop</a></div></td> </tr> </table></td> </tr> <tr> <td height="21"><div align="center"> <table width="720" height="503" border="0" class="newsframe"> <tr> <td valign="top" class="newstext"><p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center" class="style1"> </p> <p align="center" class="style3">Success!</p> <p align="center" class="style3">You request has been sent.</p> <p align="center" class="style3">Thanks for your interest!</p> <p align="center"> </p> <p align="center" class="worktext"> </p> <p align="center"> </p> <p align="center"> </p> <p align="center" class="worktext"> </p> <p align="center"> </p></td> </tr> </table> </div></td> </tr> </table> </div> <!-- end #container --> </body> </html> </tr> <div id="footer"> <table width="718" height="23" align="center"> <tr> <td width="710" height="14"><div align="center" class="contact"> <p><a href="feedback.html" class="contact" target="_blank">-Subscribe | Feedback-</a></p> </div></td> </div> </body> </html> EOD; echo "$theResults"; ?>
-
Post the actual form and please use the [ code ] [ /code ] tags to post your code in (note remove the extra spaces in the code tags)
-
<?php session_start(); // need this at the top of each page where sessions are used. include 'dbc.php'; $full_name = mysql_real_escape_string($_POST['email']); if ($_POST['Submit']=='Login') { $md5pass = md5($_POST['pwd']); $sql = "SELECT id,full_name,Money FROM users WHERE full_name = '$full_name' AND user_pwd = '$md5pass' AND user_activated='1'"; $result = mysql_query($sql) or die (mysql_error()); $num = mysql_num_rows($result); if ( $num != 0 ) { // A matching row was found - the user is authenticated. // session_start(); list($user_id,$full_name) = mysql_fetch_row($result); // this sets variables in the session $_SESSION['user']= $full_name; $_SESSION['user_id'] = $user_id; if (isset($_GET['ret']) && !empty($_GET['ret'])) { header("Location: $_GET[ret]"); } else { header("Location: myaccount.php"); } //echo "Logged in..."; exit(); } header("Location: login.php?msg=Invalid Login"); //echo "Error:"; exit(); } ?>
-
Umm post the code and we can sure help. Remember to use the [ code ] [ /code ] tags.
-
View this http://www.phpfreaks.com/forums/index.php/topic,37442.0.html
-
One, put the include inside the for loop outside of it, including it multiple times could probably be causing it, I am guessing it just defines some variables, so yea no need to have it included each loop. Second you are re-using $i for the inside for loop, change this to be $x or something like that.
-
PHP4 is bad to try programming in OOP in, I would try and do it on a PHP 5 server. Since PHP4 OOP will be outdated once most servers are 5, it is better to code for the future, not the past. Plus PHP5 handles OOP a ton better than 4 does.
-
<?php if(isset($_POST['delete'])) { $DelID = isset($_POST['DelID'])?intval($_POST['DelID']):0; if ($DelID != 0) { $sDELQUERY = "DELETE * FROM tblComment WHERE sCommentID=$DelID"; $adoConnection->Execute( $sDELQUERY ); } } ?> Try that, the intval function will convert the string to an integer.
-
Foreign key of table 2 is primary key of table 1.
-
Are you working on a PHP5 or PHP4 server? If 4, change __construct to classname and it should work.