PHP - Trouble Inserting Code Into 'if/else' Statement
I have this simple form that registers schools. This year I have decide to upgrade and include a feature that checks if the school is already registered or not based on the imputed name. Here is the code (that is the only way I know how):
mysql_connect("", "", "") or die(mysql_error( '' )); mysql_select_db("") or die(mysql_error( '' )); $query = "SELECT * FROM School_Registrations WHERE School_Name= '$_POST[SchoolName]' "; $result = mysql_query($query); if (mysql_numrows($result) > 0) { while($row = mysql_fetch_array($result)) echo" error code here";} else {mysql_query("INSERT INTO `database`.`School_Registrations` (all the variables here);") or die(mysql_error( '' )); echo "Success Code";} I am trying to incorporate this code somewhere into the 'else' statement but I have no luck. I am constantly getting some errors and when I fix one there is one more to take its place. I am lost. The last one I can not fix and I am not sure what it wants from me: Fatal error: Call to undefined function getPage() It works by itself without the if/else statement but not in the code listed above $url = 'http://www.otherpage.com/page.php?'; $url .= 'email='.urlencode($_POST['email']); $result2 = getPage('', $url, '', 15); function getPage($proxy, $url, $header, $timeout) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_HEADER, $header); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_PROXY, $proxy); curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt($ch, CURLOPT_REFERER, 'http://azsef.org'); curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.8) Gecko/2009032609 Firefox/3.0.8'); $result2['EXE'] = curl_exec($ch); $result2['INF'] = curl_getinfo($ch); $result2['ERR'] = curl_error($ch); curl_close($ch); return $result2; } Can you tell me why doesn't it work? Thanks Similar TutorialsHello, I'm having trouble inserting data into a MySQL table. The user has a form which is HEIGHT and WIDTH and NUMBER_OF_OBSERVATIONS. All these values are stored in the same table. NUMBER_OF_OBSERVATIONS does what it needs to and inserts its calculated results into the database, as does DATE_TIME. I've been trying for a couple of days to get this done, and I am having no luck in getting it sorted. Any help is greatly appreciated! Generator.php Code: [Select] $WIDTH = $_POST['WIDTH']; $HEIGHT = $_POST['HEIGHT']; $NUMBER_OF_OBSERVATIONS = $_POST['NUMBER_OF_OBSERVATIONS']; $db1 = new Number_Information(); $db1->openDB(); $OBSERVATION_ID = $db1->insert_Observation(); echo "<br /><br />Success. ID: <strong>$OBSERVATION_ID<strong>"; $db1->closeDB(); Number_Information.php Code: [Select] function insert_Observation() { //$Date_Now = datetime(); $sql = "INSERT INTO Observations (DATE_TIME, HEIGHT, WIDTH) VALUES (NOW(), '{$esc_HEIGHT}','{$esc_WIDTH}' )"; $result = mysql_query($sql, $this->conn); if (!$result) { die("SQL Insertion error: " . mysql_error()); } else { return mysql_insert_id($this->conn); } The table name is Observations Again - Any help is greatly appreciated! I've got the following code: echo <<<myStringEcho <script src="$myPluginPath/jquery.dummy.js"></script> myStringEcho; The problem is that $myPluginPath already has a / character at the end, so I don't need to put it in above But, I can't just remove it, otherwise I'll get $myPluginPathjquery.dummy.js How can I insert and have no spaces? Thanks OM I am trying to insert values stored within two dimensional array into mysql database but it does not work as I would expect it. The locations in mysql are defined as char length of 2. When I print_r the array it shows: Array( [0] => Array ( [0] => 04 [1] => 22 [2] => 27 [3] => 28 [4] => 39 [5] => 43 [6] => 47 )) but when I insert them into the mysql like this: Number1A='$MaxMillionsNumber[0][0]', Number1B='$MaxMillionsNumber[0][1]', Number1C='$MaxMillionsNumber[0][2]', Number1D='$MaxMillionsNumber[0][3]', Number1E='$MaxMillionsNumber[0][4]', Number1F='$MaxMillionsNumber[0][5]', Number1G='$MaxMillionsNumber[0][6]'; my values in mysql all show as Ar What am I doing wrong? I'm trying to create a script to use PDO prepared statements to enter data from a post form using functions to perform the PDO required statements. But, it's not working. When I execute it, it enters null in all the fields. I'm hoping someone can tell me why this is not working. I think the functions output what PDO is looking for. I'm not sure how to do this otherwise without writing a lot of code like $site_name= $_POST['site_name']; and entering all of that in the PDO statments. It seemed like it made sense to create the statements from the post array. My code is included below and after that is some output I used to monitor what is going on that shows the output of the functions in the script. Am I doing this all wrong. Is another approach that I haven't discovered? Thanks --Kenoli <?php if(isset($_POST['submit'])){ /** Establish DB connection. Not real data, of course. */ $conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); /** Remove empty $_POST elements. */ $insert_array = array_filter($_POST); /** Whitelists input to identify columns to which changes are allowed */ $whitelist = array('site_name' =>'', 'site_address' =>'', 'description' =>'', 'surface' =>'', 'tio_contact' =>'', 'site_contact' =>'', 'contact_phone' =>'', 'contact_email' =>'', 'contact_date' =>'', 'comments' =>''); $insert_array = array_intersect_key($insert_array,$whitelist); /************/ /** Create query from $insert_array. */ foreach($insert_array as $key => $value) { $col .= $key . ', '; $val .= ':' .$key . ', '; } /** Remove ', " from end of each array. */ /* For use with update actions to prevent deleting data from fields that contain data. */ $col = substr_replace($col ,"",-2); $val = substr_replace($val ,"",-2); $sql = "INSERT INTO Sites ($col) VALUES ($val)"; /* The result is: INSERT INTO Sites (site_name, site_address, description, contact_phone) VALUES (:site_name, :site_address, :description, :contact_phone)*/ /************/ /** Prepared statement functions */ $stmt = $conn->prepare($sql); foreach($insert_array as $key => $value) { $param = ':' . $key; $stmt->bindParam($param, $$value); echo '$' . "stmt->bindParam($param, $$key)<br>"; // Monitor output } foreach($insert_array as $key => $value) { $$key = $value; echo "$$key = $value<br>"; // Monitor output } $stmt->execute(); // Execute insert ?> The result with dummy data: $insert_array
(
$stmt->bindParam(:site_name, $site_name)
$site_name = asdfasdf Everything looks right but NULLs are inserted in all fields.
I have this as my code: if(!empty($stipulation)){ if($stipulation == "Championship Title Match"){ print "<h3 class=title>".$title." Match</h3>"; } else{ print "<h3 class=stipulation>".$stipulation."</h3>"; } } however I'm wanting to make it to where if it $stipulation has a value then it echos it and nothing if it doesn't have a value then don't nothing else happens. I also need a similiar if statement that will check to see if there is a value for $title and if there is then it echos $title Championship Match and again if no value exists it does nothing. I'm trying to figure out why my entire if statement is not working properly. What is happening when I run my form is that it puts it into the first if statement regardless of what the value of $style is and I don't know why. The other parts of the for submission works BUT my if statement. And inside of firebug it is passing the RIGHT post data so it has the correct value for style each time. <?php // Include the database page require ('../inc/dbconfig.php'); if (isset($_POST['submitcharacter'])) { $charactername = mysqli_real_escape_string($dbc, $_POST['charactername']); $charactershortname = mysqli_real_escape_string($dbc, $_POST['charactershortname']); $sortorder = mysqli_real_escape_string($dbc, $_POST['sortorder']); $style = mysqli_real_escape_string($dbc, $_POST['style']); $status = mysqli_real_escape_string($dbc, $_POST['status']); $alignment = mysqli_real_escape_string($dbc, $_POST['alignment']); $division = mysqli_real_escape_string($dbc, $_POST['division']); $query = "INSERT INTO `characters` (charactername, charactershortname, status_id, style_id, division_id, alignment_id, sortorder, creator_id, datecreated) VALUES ('$charactername','$charactershortname','$status','$style','$division', '$alignment', '$sortorder', 1, NOW())"; mysqli_query($dbc, $query); $query_id = mysqli_insert_id($dbc); $query1 = "INSERT INTO `allies` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query1); $query2 = "INSERT INTO `rivals` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query2); if ($style = 1) { $query3 = "INSERT INTO `singles` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query3); } elseif ($style = 2) { $query4 = "INSERT INTO `tagteams` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query4); } elseif ($style = 3) { $query5 = "INSERT INTO `managers` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query5); } } elseif ($style = 4) { $query6 = "INSERT INTO `stables` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query6); } elseif ($style = 5) { $query7 = "INSERT INTO `referees` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query7); } else { $query8 = "INSERT INTO `staff` (character_id) VALUES (".$query_id.")"; mysqli_query($dbc, $query8); } ?> Hey guys, I'm trying to get this working... No errors right now, but I'm not returning any results :/ been messing with it for days. Code: [Select] <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" /> <label for="search_by">Search By</label> <select name="search_by"> <option value"player">Player</option> <option value"city">City</option> <option value"alliance">Alliance</option> <option value"browse">Browse</option> </select> <input type="text" name"search"> <input type="submit" value="search" name="search"> <?php $search_by = $_POST['search_by']; $search = $_POST['search']; echo "<table><tr><td>Player</td><td>city</td><td>alliance</td><td>x</td><td>y</td><td>other</td><td>porters</td><td>conscripts</td><td>Spies</td><td>HBD</td><td>Minos</td><td>LBM</td><td>SSD</td><td>BD</td><td>AT</td><td>Giants</td><td>Mirrors</td><td>Fangs</td><td>ogres</td><td>banshee</td></tr>" ; $dbc = mysqli_connect('xx', 'xx', 'xx', 'xx') or die ('Error connecting to MySQL server'); $sql = "SELECT * FROM players WHERE ('$search_by') LIKE ('$search') "; //problem is here^^?? $result = mysqli_query($dbc,$sql) or die("Error: " .mysqli_error($dbc)); Not sure, any help would be greatly appreciated. Can't figure out why my form is not deleting a user from database anymore. It was working a hour ago. Now it's not working, and I have no idea why. I've tried everything. Am I missing something? Here is the delete page... Code: [Select] <html> <head> <title>Update User</title> </head> <body> <?php $dbc = mysqli_connect('localhost', 'se266_user', 'pwd', 'se266') or die(mysql_error()); //delete users echo '<b>Delete or Update User</b>.<br />'; if (isset($_POST['remove'])) { foreach($_POST['delete'] as $delete_id) { $query = "DELETE FROM users WHERE course_id = $delete_id"; mysqli_query($dbc, $query) or die ('can\'t delete user'); } echo 'user has been deleted.<br />'; } if (isset($_POST['update'])) { foreach($_POST['update'] as $update_id) { $course_id = $_POST['course_id']; $course_name = $_POST['course_name']; $student_id = $_POST['student_id']; $query = "UPDATE `users` SET `course_name` = '$course_name' WHERE `course_id` = '$course_id' AND 'student_id' = '$student_id'"; mysqli_query($dbc, $query) or die ('can\'t update course'); $update_count = $db->exec($query); } echo 'course has been updated.<br />'; } //display users info with checkbox to delete $query = "SELECT * FROM users"; $result = mysqli_query($dbc, $query); while($row = mysqli_fetch_array($result)) { echo '<input type="checkbox" value="' .$row['course_id'] . '" name="delete[]" />'; echo ' ' .$row['course_name'] .' '. $row['student_id']; echo '<br />'; } mysqli_close($dbc); ?> <form method="POST" action="update_user2.php"> <label for="course_id">Course ID:</label> <input type="text" id="course_id" name="course_id" /><br /> <label for="course_name">Course Name:</label> <input type="text" id="course_name" name="course_name" /><br /> <label for="course_name">Student ID:</label> <input type="text" id="student_id" name="student_id" /><br /> </form> <form method="post" action="update_user2.php"> <input type="submit" name="remove" value="Remove" /> <input type="submit" name="update" value="Update" /> <br> <br> </body> </html> I have the following code which seems to be in error in the conditional statement. The queries to the database produce the expected results, and the echo statements work OK. I want to make a selection based on whether data exists in the database for passState when passState=1. Can anyone tell me what is wrong with the conditional statement? Code: [Select] <?php $query1 = mysql_query("SELECT DISTINCT quizTitle, userId, passState, userScore, totalScore, DATE_FORMAT(userDate,'%b %e, %Y') AS userDate FROM quiz WHERE managerId = '$managerId' AND userId = '$userId' AND passState = 1 ORDER BY quizTitle ASC, passState DESC, userDate DESC "); $query2 = mysql_query("SELECT DISTINCT quizTitle, userId, passState, userScore, totalScore, DATE_FORMAT(userDate,'%b %e, %Y') AS userDate FROM quiz WHERE managerId = '$managerId' AND userId = '$userId' AND passState = 0 ORDER BY quizTitle ASC, passState DESC, userDate DESC "); ?> <table width="778" style="font-size:16px"> <tr> <?php if ($query1) { while ($row1 = mysql_fetch_array($query1)) { echo'<td width="13"></td> <td width="137" style="vertical-align:middle; text-align:left;">' ?> <?php echo "{$row1['quizTitle']} <br />\n"; ?> <?php echo '</td> <td width="13"></td> <td width="132" style="vertical-align:middle; text-align:left;;">' ?> <?php echo "{$row1['userDate']} <br />\n"; ?> <?php echo '</td> <td width="22"></td> <td width="112" style="text-align:center; text-align:center;">' ?> <?php if ("{$row1['passState']}" == 1) {echo "<img src=' ../wood/wood_tool_images/tick2.png' /><br />\n";}?> <?php echo '</td> <td width="30"></td> <td width="103" style="text-align:center; text-align:center;">' ?> <?php if ("{$row1['passState']}" == 0) {echo "<img src=' ../wood/wood_tool_images/cross2.png' /><br />\n";} ?> <?php echo '</td> <td width="19"></td> <td width="126" style="vertical-align:middle; text-align:center;">' ?> <?php echo "{$row1['userScore']}".'/'."{$row1['totalScore']} <br />\n"; ?> <?php echo '</td> <td width="23"></td> </tr>'; } }else{ while ($row2 = mysql_fetch_array($query2)) { echo '<td width="13"></td> <td width="137" style="vertical-align:middle; text-align:left;">' ?> <?php echo "{$row2['quizTitle']} <br />\n"; ?> <?php echo '</td> <td width="13"></td> <td width="132" style="vertical-align:middle; text-align:left;;">' ?> <?php echo "{$row2['userDate']} <br />\n"; ?> <?php echo '</td> <td width="22"></td> <td width="112" style="text-align:center; text-align:center;">' ?> <?php if ("{$row2['passState']}" == 1) {echo "<img src=' ../wood/wood_tool_images/tick2.png' /><br />\n";}?> <?php echo '</td> <td width="30"></td> <td width="103" style="text-align:center; text-align:center;">' ?> <?php if ("{$row2['passState']}" == 0) {echo "<img src=' ../wood/wood_tool_images/cross2.png' /><br />\n";} ?> <?php echo '</td> <td width="19"></td> <td width="126" style="vertical-align:middle; text-align:center;">' ?> <?php echo "{$row2['userScore']}".'/'."{$row2['totalScore']} <br />\n"; ?> <?php echo '</td> <td width="23"></td> </tr>'; } } ?> </table> Im trying to create a php template. What I want to do is take in GET data saying what page I am on, then include that in the template. THe trouble is I cant get the damn thing to work, it keeps saying the file does not exist! Here is my code <!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>Untitled Document</title> </head> <body> <div class="content"> <?php $page = $_GET['page']; $path = '/inc ' .$page .".php"; if(!isset($page)) { die('No Page Specified'); } if (file_exists($path)) { include($path); } else { die('Does not exsist!'); } ?> </div> </body> </html> Having update statement trouble... The error I'm getting is... "Could not query the database - : " Not sure what I'm missing, I had this working before also, but now it's not. Here is my code for the update page... Code: [Select] <html> <head> <title>Update User</title> </head> <body> <form method="post" action="update_user2.php"> <?php $dbc = mysqli_connect('localhost', 'se266_user', 'pwd', 'se266') or die(mysql_error()); //delete users echo '<b>Delete or Update User</b>.<br />'; if (isset($_POST['remove'])) { foreach($_POST['delete'] as $delete_id) { $query = "DELETE FROM users WHERE course_id = $delete_id"; mysqli_query($dbc, $query) or die ('can\'t delete user'); } echo 'user has been deleted.<br />'; } if (isset($_POST['update'])) { $course_id = $_POST['course_id']; $course_name = $_POST['course_name']; $student_id = $_POST['student_id']; $query = "UPDATE users SET course_name ='". $course_name ."' WHERE course_id = $course_id"; $updres = mysqli_query($query); if(!$updres) { die(" Could not query the database - : <br/>". mysqli_error() ); } else { echo 'course has been updated.<br />'; } } //display users info with checkbox to delete $query = "SELECT * FROM users"; $result = mysqli_query($dbc, $query); while($row = mysqli_fetch_array($result)) { echo '<input type="checkbox" value="' .$row['course_id'] . '" name="delete[]" />'; echo ' ' .$row['course_name'] .' '. $row['student_id']; echo '<br />'; } mysqli_close($dbc); ?> <form method="POST" action="update_user2.php"> <label for="course_id">Course ID:</label> <input type="text" id="course_id" name="course_id" /> <br /> <label for="course_name">Course Name:</label> <input type="text" id="course_name" name="course_name" /> <br /> <label for="course_name">Student ID:</label> <input type="text" id="student_id" name="student_id" /> <br /> <input type="submit" name="remove" value="Remove" /> <input type="submit" name="update" value="Update" /> <br><br> </form> </body> </html> I am trying to create a query to insert data into a table in my Access database. I have the following query:
INSERT INTO Issues (DateRequested, CustomerID, ComputerID, Issue, ItemsIncl, ImageName) VALUES (#1/14/2015#, 1, 1, "Computer freezes while I'm on the internet.", "AC Adapter", "none.gif")which should be performed from within my PHP page. However, when I check the database afterward, the new record isn't there. I then tried performing the query directly in Access and it worked fine. Why would it work in Access, but not when I run the same query in PHP? Chris This is kind of hard to explain, but I will try my best. I have a script that is attempting to display information in a MySQL database by month fields that are chosen by the user. For instance, they can choose for the start date to start in January, and pick the end date which in this example will be April. The script then puts the required field that match the specific dates into a column for each month. For the most part it outputs fine as: Jan: 15, Feb: 14, Mar: 9, Apr: 2. However, sometimes there is nothing in the database for certain months. This causes the script to display wrong so instead I get: Jan 3, Feb: , Mar: , Apr: . In the above example, the Jan: 3 might be wrong, because the field might have been for Mar instead. I need it to display like this when there is no fields in the database: Jan: 0, Feb: 0, Mar: 3, Apr: 0. How would I go about doing this? Hi, I tried putting this Viglink code into my custom themes index.template.php on my SMF forum (I should do that right?) and I ended up with this error... Code: [Select] Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in .../Themes/androidrtk_rev4n/index.template.php on line 554 545: subMenusContainerId:\'admsubMenus\', 546: duration:\'150\' 547: }); 548: }); 549: } 550: </script> 551: 552: <script type="text/javascript"> 553: var vglnk = { api_url: '//api.viglink.com/api', 554: key: 'ad93febdf4e33c034d9635037b687fb3' }; 555: 556: (function(d, t) { 557: var s = d.createElement(t); s.type = 'text/javascript'; s.async = true; 558: s.src = ('https:' == document.location.protocol ? vglnk.api_url : I figured since it was a copy paste code that it would work just fine In any case, how can I fix this? Thanks in advance, Jimmy I am trying to insert a new user into my database from my php code. This is the error message that I am getting from the webpage: Quote Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'order, previousOrder) VALUES ('c_s@gmail.com','test','3','callulm','Smith','17' at line 1 This is the code that I am using: Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("deliverpizza", $con); $sql="INSERT INTO customer(userName, password, privilege, firstName, lastName, address, postCode, order, previousOrder) VALUES ('$_POST[username]','$_POST[password]','$_POST[privilege]','$_POST[firstname]','$_POST[lastname]','$_POST[address]','$_POST[postcode]','$_POST[order]','$_POST[previousOrder]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?> Hi and thank you in advance for helping me. Here is the code fragment: $sql="SELECT UserID,UserName FROM `UserValidation` WHERE UserID='".$_SESSION["UserID"]."'"; $rs=CustomQuery($sql); $RecData=db_fetch_array($rs); global $conn,$strUserValidation; $strSQLSave = "INSERT INTO RecruiterNames (UserID, UserName) values ("; $strSQLSave .= $RecData["UserID"].","; $strSQLSave .= chr(34).$RecData['UserName'].chr(34); $strSQLSave .= ")"; db_exec($strSQLSave,$conn); Here is the error I receive: php error happened Technical information Error type 256 Error description You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"")' at line 1 URL www.dealwithaces.com/ACESDB/register.php? Error file /home/debra/public_html/dealwithaces.com/ACESDB/include/dbconnection.php Error line 36 SQL query INSERT INTO RecruiterNames (UserID, UserName) values (,"") More info Call stack File: line Function Arguments #0. include/dbconnection.php:36 db_query 1. INSERT INTO RecruiterNames (UserID, UserName) values (,""); 2. Resource id #10; #1. include/dbconnection.php:47 db_exec 1. INSERT INTO RecruiterNames (UserID, UserName) values (,""); 2. Resource id #10; #2. include/events.php:25 AfterSuccessfulRegistration 1. Array ( [UserName] => bsbnick [Password] => kaos55 [UserEmail] => mike@world-class-multimedia.com [GroupID] => 1 [UserActive] => 0 ) ; #3. register.php:298 Global scope N/A I need two fields from UserValidation table (UserID and UserName) to be inserted into table RecruiterNames (UserID and UserName), but ONLY when GroupID = 3 Thank you again for your help. Mike Hi Group, I looked through the internet and couldn't find an answer, but I was wondering on the appropriate syntax on inserting PHP code into an input element. See below. <input type="text" name="id" value="<?php echo $main['id']; ?>" size="10" /> Now this is purely an example (and I'm aware of php short tags, just don't want to use them). I only ask cause I've used CodeLobster and Eclipse and they don't really know what to do with the added php syntax. CodeLobster and Eclipse wouldn't finish marking up the rest of the line in the appropriate colors (all the text was black after the < in <?php like how I showed it above), however Eclipse's built in debug system thinks this is a syntax error. It runs just fine in the browser and does what I want it to, but I'd like the appropriate systax to get rid of this "error". Thanks in advance, ImmortalFirefly Hi guys,
Having some trouble entering some php into my wordpress site that runs on Optimize Press.
I'm trying to insert this URL/ tracking code into my page as a hyperlink - 'Click Here Now'.
http://www.mysite.co...1_50onRed&sub1=<?php echo $sub1; ?>&sub2=<?php echo $sub2; ?>&sub3=<?php echo $sub3; ?>&sub4=<?php echo $sub4; ?>&sub5=<?php echo $sub5; ?>&lpid=<?php echo $lpid; ?>
This is what I have done so far:
<a href="http://www.mysite.co...;sub1=<?php echo $sub1; ?>&sub2=<?php echo $sub2; ?>&sub3=<?php echo $sub3; ?>&sub4=<?php echo $sub4; ?>&sub5=<?php echo $sub5; ?>&lpid=<?php echo $lpid; ?>">Click Here Now</a>
This does generate a hyperlink, however when I click it, I get: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=' at line 2
I understand for this code to work the page has to be saved in php. I thought wordpress did this automatically?
Can anyone help please? Also, please bear in mind I am using the Optimize Press plugin.
Many thanks in advance!
Tom
I have 2 files; Newfault.php and thankyou.php 1) Data is entered into a form in Newfault.php 2) The data from this form is retieved in thankyou.php and is then inserted into a table called "Calls" Problem: My entered record is being added to my database OK, but it is also adding a blank record for some reason and I can't work out why. Can anyone help? This is for my uni assignment. Thanks, Ladykudos Im inserting HTML into a database, and then outputting it on a PHP page. Its an iframe code, so when I output it, it shows the iframe. I need it to just display the HTML code. How can I do this? I thought it would be something simple but I can find anyway to do it. Help very appreciated!! Thanks |