PHP - Am I Missing A Minor Detail?
I have a form with a table that contains ONLY dropdown menus for users to select quantities from 25 dinner items. It contains some Javascript, but nothing fancy. In an effort to establish my database and TEST to see how some PHP functions might respond so I could improve my form, I created a mini version of the db in MySQL.
But when I click the submit button, the page blinks, the address bar fills with field names, but there is no connect. No error messages. No data transfer. NO NOTHING! I searched the web and copied a form and plugged it in (an html form, a php insert file, and a MySQL database) and it worked fine. I peared down my page to mirror it, and still, no success. What little detail am I missing?? If I have 25 fields but create a db for the first 6, should it function? If I reduce it and try to re-use the same db, am I persuing a problem? I've tried error trapping and changing the form inputs, but it just still doesn't connect. Please help! Similar TutorialsHello, I have a database with the following tables: students groups exams examDay relation master detail ======= ===== ===== ======= ====== ====== ===== idStudent idGroup idExam idExDay idRelation idMaster idDetail idGroup groupName examName exDate idGroup idGroup idMaster studName idExDay idRelation idExam idExam idStudent coursesAtt idExDay I am trying to make a report from the Master and Detail tables that will have the table header like this: Group | Examination Date | Student Name | Exam1 | Exam2| .... | Exam n in which Exam1, Exam2,... are the exams names and they had to take the values from coursesAtt column. Is this possible? I could make a view (doing joins and group by) by the results will be displayed on row. That's why I ask for your help. Thanks php can detect "mac address", "ip address", "browser agent", "cookie" and "hostname". What else php can detect? I am an extremly novice at this php stuff. I have a file that displays a vehicle listing based on a xml feed. I am trying to add a link to another detail page by clicking on the words Full Detail (bolded below in the code) and send me to another page (index.php?option=com_content&view=article&id=6 (joomla)), the item detail page is based on the vehicle id and has the vehicle details show up. the detail page is also a xml file with the item info. I assume I have to use the <a href.... but how do I add the Id of the vehicle. Do I use a .($_Get['vehicleid']). Follow me? Partial Listing of Vehciles Code: [Select] $doc = new DOMDocument(); $doc->loadXML($output); $vehicles = $doc->getElementsByTagName("vehicle"); //print_r($xmlarray); $results = print_r($xmlarray, true); echo $results; foreach ($vehicles as $vehicle) { $vehicleIDs = $vehicle->getElementsByTagName("vehicleID"); $vehicleID = $vehicleIDs->item(0)->nodeValue; $years = $vehicle->getElementsByTagName("year"); $year = $years->item(0)->nodeValue; $makes = $vehicle->getElementsByTagName("make"); $make = $makes->item(0)->nodeValue; $models = $vehicle->getElementsByTagName("model"); $model = $models->item(0)->nodeValue; $prices = $vehicle->getElementsByTagName("price"); $price = $prices->item(0)->nodeValue; $modelExts = $vehicle->getElementsByTagName("modelExt"); $modelExt = $modelExts->item(0)->nodeValue; $conditions = $vehicle->getElementsByTagName("condition"); $condition = $conditions->item(0)->nodeValue; $auxPhotoss = $vehicle->getElementsByTagName("auxPhotos"); $auxPhotos = $auxPhotoss->item(0)->nodeValue; $transmissions = $vehicle->getElementsByTagName("transmission"); $transmission = $transmissions->item(0)->nodeValue; $cylinderss = $vehicle->getElementsByTagName("cylinders"); $cylinders = $cylinderss->item(0)->nodeValue; $fueltypes = $vehicle->getElementsByTagName("fueltype"); $fueltype = $fueltypes->item(0)->nodeValue; $doorss = $vehicle->getElementsByTagName("doors"); $doors = $doorss->item(0)->nodeValue; $financings = $vehicle->getElementsByTagName("financing"); $financing = $financings->item(0)->nodeValue; $paymentFrequencys = $vehicle->getElementsByTagName("paymentFrequency"); $paymentFrequency = $paymentFrequencys->item(0)->nodeValue; $kilometerss = $vehicle->getElementsByTagName("kilometers"); $kilometers = $kilometerss->item(0)->nodeValue; $imgSrcs = $vehicle->getElementsByTagName("imgSrc"); $imgSrc = $imgSrcs->item(0)->nodeValue; $formattedprice = sprintf("%01.2f", $price); $price_currency = number_format($price, 2, ".", ","); if ($price_currency == 0) { $price_currency = "CONTACT DEALER"; } $featuress = $vehicle->getElementsByTagName("features"); $features = $featuress->item(0)->childNodes; $featureCount = $features->length; $i = 0; $featurestring = ""; while ($i < $featureCount) { $i++; $featureA[$i] = $features->item($i - 1)->nodeValue; $featurestring .= ($i % 2 == 0 ? $featureA[$i] . ", " : ""); } echo "<table style=background-color: rgb(246, 246, 246)text-align: left width: 900px height: 100px\n"; echo " border=0 cellpadding=2 cellspacing=2>\n"; echo " <tbody>\n"; echo " <tr>\n"; echo " <td\n"; echo " style=background-color: black font-family: Helvetica,Arial,sans-serif><small><span\n"; echo " style=color: yellow><span style=font-weight: bold>Vehicle ID:</span>\n"; echo " $vehicleID</span></small></td>\n"; echo " <td\n"; echo " style=background-color: rgb(255, 204, 0) font-family: Helvetica,Arial,sans-serif width: 147px><small>Year:\n"; echo " $year</small></td>\n"; echo " <td\n"; echo " style=background-color: rgb(255, 204, 0) font-family: Helvetica,Arial,sans-serif width: 109px><small>Make:\n"; echo " $make</small></td>\n"; echo " <td\n"; echo " style=background-color: rgb(255, 204, 0) font-family: Helvetica,Arial,sans-serif width: 141px><small>Model:\n"; echo " $model</small></td>\n"; echo " <td\n"; echo " style=background-color: black font-family: Helvetica,Arial,sans-serif width: 147px><small><span\n"; echo " style=color: rgb(255, 204, 0) font-weight: bold>Price: $\n"; echo " $price_currency</span></small></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td colspan=1 rowspan=3><small><span\n"; echo " style=font-family: Helvetica,Arial,sans-serif><img src=$imgSrc></span></small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small>Condition:\n"; echo " $condition</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 109px><small></small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 141px><small></small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small></small></td>\n"; echo " </tr>\n"; echo " <tr width=147\n"; echo " style=font-family: Helvetica,Arial,sans-serif>\n"; echo " <small></small><td\n"; echo " style=background-color: black width: 147px colspan=4 \n"; echo " rowspan=1><span style=color: rgb(255, 204, 0)><a href=\"http://heavyequipmentwantedads.com/icardemo/inventory/getitems.php?&$vehicleID\" title=\"Full Details (View)\" target=\"_new\">Full Details (View)</a></span></td>\n"; echo " <small></small></tr>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small>Transmission\n"; echo " : $transmission</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 109px><small>Doors:\n"; echo " $doors</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 141px><small>FuelType: $fueltype</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small>KM:\n"; echo " $kilometers</small></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td style=background-color: rgb(204, 204, 204)><small></small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small>Cylinders:\n"; echo " $cylinders</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 109px><small></small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 141px><small>Features: $featurestring</small></td>\n"; echo " <td\n"; echo " style=font-family: Helvetica,Arial,sans-serif width: 147px><small></small></td>\n"; echo " </tr>\n"; echo " </tbody>\n"; echo " </table>\n"; Partial listing of items: Code: [Select] <?php $xmldata ='<dealerAccount> <accountNum>xxxxxx</accountNum> <dealerPwd>xxxxxxxxx</dealerPwd> <data>item</data> <vehicleID>'.$vehicleID.'</vehicleID> </dealerAccount>'; $URL = "http://www.wheelsonline.ca/api/"; $ch = curl_init($URL); //curl_setopt($ch, CURLOPT_MUTE, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml')); curl_setopt($ch, CURLOPT_POSTFIELDS, "$xmldata"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); curl_close($ch); $doc=new DOMDocument(); $doc->loadXML($output); $items=$doc->getElementsByTagName("item"); $results = print_r($xmlarray, true); echo $results; ?> I want to create a master-detail page using PHP. Rather than getting data from a MYSQL database, I want to get the data from an associative array. Is this possible? Please someone show me the way forward. Please help. Hi all expert. I am a newbie in this PHP programming. I need your help or advise on the PHP. And question is, I have a list of data and the details are as below:
ID BILLNO DATE AMOUNT ITEM DESCRIPTION QTY UPRICE 1 IV001 01/01/2015 100.00 A1 Balloon 1 30.00 2 IV001 01/01/2015 100.00 A2 Bag 2 20.00 3 IV001 01/01/2015 100.00 A3 Pen 3 10.00 4 IV002 02/01/2015 20.00 A3 Pen 2 10.00 5 IV003 02/01/2015 50.00 A1 Balloon 1 30.00 6 IV003 02/01/2015 50.00 A2 Bag 1 20.00 How can I make the output in xml by using PHP to output as below: <RECORD> <HEADER BILLNO="IV001" DATE="01/01/2015" AMOUNT="100.00> <DETAIL ITEM="A1" DESCRIPTION="Balloon" QTY="1" UPRICE="30.00"> </DETAIL> <DETAIL ITEM="A2" DESCRIPTION="Bag" QTY="2" UPRICE="20.00"> </DETAIL> <DETAIL ITEM="A3" DESCRIPTION="Pen" QTY="3" UPRICE="10.00"> </DETAIL> </HEADER> <HEADER BILLNO="IV002" DATE="02/01/2015" AMOUNT="20.00> <DETAIL ITEM="A3" DESCRIPTION="Balloon" QTY="2" UPRICE="10.00"> </DETAIL> </HEADER> </RECORD> Your feedback is highly appreciated. Thank you. This is my code is display my database (member_details) after user sign up but when a user register first name = <script>window.location="google.com"</script> This error occur=(The requested URL /yy2/html/google.com was not found on this server) Code: [Select] <?php session_start(); include ('includes/database_connection.inc.php'); $conn = connectDatabase(); if($_SESSION['uid'] == ''){ // redirect unauthenticate user to login page. header('Location: login.php'); } if($_GET['task'] == 'delete' && $_GET['id'] != ''){ // delete function here $sql="DELETE FROM Newest Where ID='".mysql_real_escape_string($_GET['id'])."'"; mysql_query($sql,$conn); header('Location: member_list.php'); } if($_POST['Logout']){ session_destroy(); header('Location: login.php'); } ?> <html><head><title>Member Details</title> </head> <body> <div style=" margin: 350px "> <?php $sql="SELECT * FROM Newest"; $rs = mysql_query($sql,$conn) or die( mysql_error() ); $list = "<table border=\"1\" cellpadding= \"2\">"; $list .= "<tr><th>First Name</th>"; $list .="<th>Last Name</th>"; $list .= "<th>User Name</th>"; $list .= "<th>Email</th>"; $list .= "<th>Edit User</th>"; $list .= "<th>Delete User</th>"; $list .= "<th>Change Password</th>"; While( $row = mysql_fetch_array($rs) ) { $list .= "<tr>"; $list .= "<td>".$row["name"]."</td>"; $list .= "<td>".$row["last"]."</td>"; $list .= "<td>".$row["user"]."</td>"; $list .= "<td>".$row["email"]."</td>"; $list .= "<td><a href='member_details.php?id=".$row['ID']."'>Edit</a></td>"; $list .= "<td><a onclick='return confirm(\"Are you sure to delete ".$row["name"]." \")' href='member_list.php?id=".$row["ID"]."&task=delete'>Delete</a></td>"; $list .= "<td><a href='Password.php?id=".$row['ID']."'>Click Here</a></td> </tr>"; } $list .= "</table>"; echo ( $list ); ?> <form method="post" action="member_list.php"><br> <div style="margin : 0px 600px"> <style type="text/css"> body {background:#F5F5F5 url('http://images.apple.com/downloads/dashboard/travel/images/traveltodolist_20070724165034.jpg') no-repeat top;; }</style> <input type="submit" name="Logout" value="logout" /> </form> </body> </html> MOD EDIT: [code] . . . [/code] BBCode tags added. I have a product page which populates all my products in one page. I have also a detail page which gives details on a product which i wanted to know. My problem is when I am going to click on the product that I want the detail page shows incorrect product details. I just want one detail product page so that it will be easy to edit the page in the future. I am asking an Idea on how to make one detail page in all of my products.. thanks... ok , this is to request someone to be your friend and i keep getting an error saying "mysql_error() expects parameter 1 to be resource" i dont know what is wrong , it worked before ... please help. Code: [Select] <?php if ($_POST["request"] == "requestFriendship") { $mem1 = preg_replace('#[^0-9]#i', '', $_POST['mem1']); $mem2 = preg_replace('#[^0-9]#i', '', $_POST['mem2']); // if (!$mem1 || !$mem2 || !$thisWipit) { echo 'Error: Missing data'; exit(); } // if ($mem1 == $mem2) { echo 'Error: You cannot add yourself as a friend'; exit(); } //See if already friends $sql1 = "SELECT id FROM friends WHERE mem2='$mem1' AND mem1='$mem2' LIMIT 1"; $result1 = mysql_query($sql1) or die (mysql_error("sql1 failed")); $data1 = mysql_fetch_row($result1); if ($data1[0]) { echo 'This member is already your Friend'; exit(); } //Check if user already requested to be friends $sql2 = "SELECT id FROM friends_requests WHERE mem1='$mem1' AND mem2='$mem2' Limit 1"; $result2 = mysql_query($sql2) or die (mysql_error("sql2 failed")); $data2 = mysql_fetch_row($result2); if ($data2[0]) { echo '<img src="images/round_error.png" width="20" height="20" alt="Error" /> You have a Friend request pending for this member. Please be patient.'; exit(); } //Check if friend already requested to be friends $sql3 = "SELECT id FROM friends_requests WHERE mem1='$mem2' AND mem2='$mem1' Limit 1"; $result3 = mysql_query($sql3) or die (mysql_error("sql3 failed")); $data3 = mysql_fetch_row($result3); if ($data3[0]) { echo '<img src="images/round_error.png" width="20" height="20" alt="Error" /> This user has requested you as a Friend already! Check your Requests on your profile.'; exit(); } //If still here make insert $mem1=mysql_real_escape_string($mem1); $mem2=mysql_real_escape_string($mem2); $sql = mysql_query("INSERT INTO friends (mem1, mem2, timedate) VALUES('$mem1','$mem2',now())") or die (mysql_error("Friend Request Insertion Error")); echo '<img src="images/round_success.png" width="20" height="20" alt="Success" /> Friend request sent successfully. This member must approve the request.'; exit(); } ?> Hi All, I have been handed a site from a friend of mine to fix as there were a few errors on it. I have only had very little experience with php coding and believe im doing well so far as i only have one more error to rectify on this particular site. Is any one familiar with the following error codes and how to resolve them? Warning: include(list_.inc.php) [function.include]: failed to open stream: No such file or directory in /home/user/public_html/list.php on line 13 Warning: include(list_.inc.php) [function.include]: failed to open stream: No such file or directory in /home/user/public_html/list.php on line 13 Warning: include() [function.include]: Failed opening 'list_.inc.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/user/public_html/list.php on line 13 Iv done a bit of research and to me it doesn't seem like a huge fix and i think its something i am capable of doing myself i just need a bit of guidance. Any help greatly appreciated. Michael Hi
I have a small script, on a single file that needs to be optimized.
file is about 300 lines (16Kb), and basiccaly looks like the "PHP-monster" threw up on it.
Script is working ok, but surely could be much better.
PM if interested and I can send you a copy of file. If possible leave price/hourly rate.
Hi Friends , We have the JSON Data coming in this format, $invoice_data = { "CONTACT_ID": "1", "INV_SERIAL_NO": "100", "NAME": "baby", "INV_DATE": "2018-06-27", "DUE_DATE": "2018-06-27", "CURRENCY": "KD", "SUBTOTAL": "143", "TAX_TOTAL": "13", "shipment_data": [ { "SHIP_SERIAL_NO": "44", "MASTER_NO": "55", "HOUSE_NO": "88", "cost_revenue_items": [ { "CHARGE_REF": "tt", "CURRENCY": "INR", "QUANTITY": "2", "SELLING_RATE": "45", "EXCHANGE_RATE": "987" },{ "CHARGE_REF": "ii", "CURRENCY": "INR", "QUANTITY": "2", "SELLING_RATE": "45", "EXCHANGE_RATE": "456" },{ "CHARGE_REF": "op", "CURRENCY": "INR", "QUANTITY": "2", "SELLING_RATE": "45", "EXCHANGE_RATE": "456" } ] } ] } How to write DELETE End-point for child data-set "cost_revenue_items". What I mean to say is how to handle the request to delete one of item from "cost_revenue_items".
When "cost_revenue_items" will be deleted ,master "invoice_data" will be updated. This update , we can handle by PUT, but how do we know under that PUT, we have to Will JSON request to delete "cost_revenue_items" looks like this ,if it want to delete last record : $invoice_data = { "CONTACT_ID": "1", "INV_SERIAL_NO": "100", "NAME": "baby", "INV_DATE": "2018-06-27", "DUE_DATE": "2018-06-27", "CURRENCY": "KD", "SUBTOTAL": "143", "TAX_TOTAL": "13", "shipment_data": [ { "SHIP_SERIAL_NO": "44", "MASTER_NO": "55", "HOUSE_NO": "88", "cost_revenue_items": [ { "CHARGE_REF": "tt", "CURRENCY": "INR", "QUANTITY": "2", "SELLING_RATE": "45", "EXCHANGE_RATE": "987" },{ "CHARGE_REF": "ii", "CURRENCY": "INR", "QUANTITY": "2", "SELLING_RATE": "45", "EXCHANGE_RATE": "456" } ] } ] } Kindly help me to know , how JSON request will look like ?
Thanks a lot Hey guys im having 2 minor problems with my script if someone can give me some advise please?
(all 2 problems are commented on the script itself)
1. highlighting string characters when typed.
2. also im trying to add "Hide Suggestions" at the bottom of my menu so people can turn on/off autocomplete
$(document).ready(function() { function search_autocomplete(selector, tags, default_value) { $('#' + selector).focus(function() { if($('#' + selector).val() == default_value) { $('#' + selector).val(''); } }); $('#' + selector).blur(function() { if($('#' + selector).val() == '') { $('#' + selector).val(default_value); } }); $('#' + selector).autocomplete( { source: tags, timeout: 0, select: function (a, b) { $(this).val(b.item.value); //submit }, create: function () { $(this).data('ui-autocomplete')._renderItem = function (ul, item) { // not highlighting when string characters match var re = new RegExp('^' + this.term); var t = item.label.replace(re, "<span id='dropdown-item-highlight'>" + "$&" + "</span>"); return $('<li></li>') .append('<a>' + t + ' in ' + item.type + '</a>') .addClass( 'dropdown-item' ) .appendTo(ul); }; } }); $(this).data('ui-autocomplete')._renderMenu = function (ul, item) { // unable to show "Hide Suggestions at the bottom of the autocomplete menu return $('<ul></ul>') .append('<a>Hide Suggestions</a>') .addClass( 'dropdown-menu' ); }; } var availableTags = [{"label" : "XBOX 360", "type":"Electronics"}, {"label":"XBOX One", "type":"Electronics"}, {"label":"Nike", "type":"Clothing & Footwear"}]; search_autocomplete('query', availableTags, 'Search...'); });thanks Good day dear community. I need to build a function which parses the domain from a url. I have used various ways to parse html sources. But this one is is a bit tricky! See the target i want to parse - it has some invaild Markup: http://www.schulministerium.nrw.de/BP/SchuleSuchen?action=644.0013008534253&SchulAdresseMapDO=194190 well what do you think - can i apply this code here <?php require_once('config.php'); // call config.php for db connection $filename = "url.txt"; // Include the txt file which have urls $each_line = file($filename); foreach($each_line as $line_num => $line) { $line = trim($line); $content = file_get_contents($line); //echo ($content)."<br>"; $pattern = '/<td>(.*?)<\/td>/si'; preg_match_all($pattern,$content,$matches); foreach ($matches[1] as $match) { $match = strip_tags($match); $match = trim($match); //var_dump($match); $sql = mysqli_query("insert into tablename(contents) values ('$match')"); //echo $match; } } ?> well i have to rework the parser-part of this script. I need to parse somway different - since i have other site here. Can anybody help me here to get a better regex - or a better way to parse this site ... Any and all help will be greatly apprecaited. regards db1 I just installed this new script here http://webhost.pro/domain-check.php it's a basic domain availability tool. I am trying to make a form that can be used on any page forward to this page with the content. The page loads with this in the url webhost.pro/domain-check.php?domain=dwhs.net and will run the page. So I can make a form that just submits to that page and sends the details. I made this page for testing http://webhost.pro/test.html But no go, here is the code: <form id="search" action="/domain-check.php" method="GET"> <input type="text" name="s"> <a onClick="document.getElementById('search').submit()" class="button1">Search</a> <div class="clear"></div> </form> Thanks! Hi, I have successfully implemented a master details page with the results aligned in columns linking to a details page. I wish to maintain the recordID passed from the master details page and make the dynamic text, which reads Shade A tree that is capable of..... in the attached screen shot a link to another details page referencing the same recordID. The detailspage2.php would look the same as the screenshot except the Shade text and description below will be highlighted, which I can do, there will be a new image and a new image description. All other dynmaic elements on the page will remain the same. I tried to simply save as my detailspage.php to detailspage2.php and create a link to detailspage2.php. It linked to detailspage2.php but none of the record info showed up in their respective table cells. I have all the names desc's, images, etc setup in a table in my database. Please let me know what code and other info you need to help me out with this procedure. Thanks. To make a long story short, I have a series of forms, where certain options are visible depending on what the user selected on the previous form. The final form processing is where I'm having issues. I have the following for each option, to check if that option was selected (this is all somewhat pared down for clarity): Code: [Select] if (isset($_POST['option1']) && $_POST['option1'] > 0){ $option1 = mysql_real_escape_string($_POST['option1']); $query1 = "DELETE FROM table WHERE itemid = '$option1'"; } I have that basic thing for each of the options, where it assigns a deletion query based on each individual option. Later in my code, I have the following, which again checks if each option was selected (it's restated because it's after several error checks) then is supposed to run the query that was assigned in the previous part: Code: [Select] if ($_POST['option1'] > 0){ mysql_query($query1); } if ($_POST['option2'] > 0){ mysql_query($query2); } if ($_POST['option3'] > 0){ mysql_query($query3); } (etc, for all the options) My problem is that the queries are not executing and I can't see any reason why not. Query #1 is working... it executes the deletion query and all is well, but if I try to select any options other than #1, the query doesn't execute. I tried echoing the queries within the second if statements above (where it runs the queries) and it's echoing them fine (and they look normal), so I know it's able to run the queries, it just isn't... Am I blind? lol. I must be missing something obvious because this is driving me crazy. Thank you in advance. Please let me know if you need more info. Really not seeing where my missing parenthesis goes. Code: [Select] if(isset($this->uri->segment(3)) AND ((empty($this->uri->segment(3))||($this->uri->segment(3) === FALSE)||(trim($this->uri->segment(3)) == ''))) Hi. I am new to PHP and trying out database connections. I am trying to query the database, to see if the date matches a record in the field 'date'. If it does echo yes, if there are no matches 'no'. Can anyone tell me what is missing from my code: Code: [Select] <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("date_picker", $con); $date= $_POST['date']; $new_date = date('Y-m-d',strtotime($date)); $sql = 'SELECT date FROM availability' if (date = $new_date) echo "Yes"; else echo "No"; mysql_close($con) ?> I am running a search query from MYSQL and it works, but now I want to get a little custom. I am selecting one field, out of many called paid1 which in database is either Yes or No. I want to do this: if paid1 is NO display Pay Now and everything else display Yes. I want this to be under new heading of paid1b. So the code should look something like this: $paid1b= if(['paid1'}==No){echo "Pay Now";} else {echo "YES";} But I am missing something somewhere. What is it? Thanks |