Jump to content

bumba000

Members
  • Posts

    55
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

bumba000's Achievements

Member

Member (2/5)

0

Reputation

  1. Thanks for the reply. This isn't gonna be used with a site or online in any way. Just for our local customers and for my own php practice. This is what I have so far for my Create_Invoice.php <table width="94%" border="0" align="center" cellpadding="2"> <tr> <td width="10%"> </td> <td width="63%"><div align="center">Customer Information </div></td> </tr> <tr> <td class="style1">Name </td> <td><form action="insert.php" method="post"> <label> First <input name="firstName" type="text" id="firstName" size="20" /> </label> Last <label> <input name="lastName" type="text" id="lastName" size="20" /> </label> </td> </tr> <tr> <td class="style1">Adderess</td> <td><label>Street <input name="street" type="text" id="address" value="" size="40"></label><br /> <lable>City <input name="city" type="text" id="city" value="" size="40"> </lable><br /> <lable>State <input name="state" type="text" id="state" value="" size="5"> </lable> <lable>Zip<input name="zip" type="text" id="zip" value="" size="8"> </lable></td> </tr> <tr> <td class="style1">Phone</td> <td><input name="phone" type="text" id="phone" size="20" /><br /><br /> </td> </tr> <tr><td><label> <input name="site" type="radio" value="12volt"> 12Volt</label><label> <input name="site" type="radio" value="stomp"> Stomp</label></td><td><input type="submit" name="Submit" value="Submit"></form></td></tr> </table> This is the insert.php <?php $con = mysql_connect("localhost","root","iforgot1"); if (!$con) { die('Could not connect: ' . mysql_error()); } $date = date("F j, Y"); // March 10, 2001 mysql_select_db("Invoicing", $con); $sql="INSERT INTO customer_invoice (FirstName, LastName, Street, City, State, Zip, Phone, Date, Site) VALUES ('$_POST[firstName]','$_POST[lastName]','$_POST[street]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[phone]', '$date','$_POST[site]')"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } echo "1 record added"; mysql_close($con) ?>
  2. Hi All, I have made a form, an "insert.php" and a DB to go along with it. For now my form has only Fname, Lname, Address and phone. I need to add fields for Model, Descrip, Qty and Price. My DB has two tables. One called customer_invoice and one called Orders. Both have an ID record as well. I would like to have my form (with the name and address. . .) also have multiple fields for product model, descrip. . . How can I have many fields (product area) input into the db and have the same ID as the customer? Also, how can many fields use the same name? Is there a better way to do what I'm trying to accomplish? Thanks in advance, John
  3. OMG what a jerk! I can't believe I did that. I am trying soooo hard and doing my absolute best to learn this stuff. Little things like this . . . ERRRRR. That's cool though. Thank you so much for seeing that. John
  4. That didnt work. On the bright side I am only getting results for those website id's that are in the marks table. So I know that the query is functioning properly. My code hasn't changed from above except for the addition of the commented out var_dump($array);. What am I missing here? Thank you, John
  5. Thanks for that. Here are my results. I'm not sure what to make of them. array( { [0]=> string(2) "22" ["website_id"]=> string(2) "22" [1]=> string(9) "BlinkList" ["network_name"]=> string(9) "BlinkList" [2]=> string(1) "1" ["partner_id"]=> string(1) "1" [3]=> string(10) "1220677200" ["date"]=> string(10) "1220677200" }
  6. Hi All, I have a db connection and am getting results here. The problem seems to be with my in_array. I have a table called marks. I have a record in there with the value of 22 in the website_id field. The network_name field of the record has the name Blinklist in it. Below is an example of my table and a single record. Below that is the code in question. As you can see, Blinklist is in the record but I get the echo response "Its Not Here". Why? Thanks in advance, John MARKS: website_id | network_name | date 22 | Blinklist | 1220677200 $webSiteID = $rowGetClient['website_id']; $getMarksList = mysql_query("SELECT * FROM marks WHERE website_id = 22"); if(!$getMarksList) { die("Get List Failed: " . mysql_error()); }?> <?php while ($array = mysql_fetch_array($getMarksList)){ if (in_array("Blinklist", $array)) { echo "Its Here";}else{echo "Its Not Here";} echo '<br>'."ID=:" . $webSiteID; } ?>
  7. genericnumber1 my line 25 is $clientCustomersID = $_SESSION['customer_id']); EDIT: Genericnumber1 Ohhhh. I see it. That is the right line. Thanks for that! Ken2k7 there is already a session started this is in a functional cart. $_SESSION['customer_id'] exists I can echo $_SESSION['customer_id'] . $_SESSION['customer_firstname']; and come up with the correct info. Will wrapping each variable in it's own single quotes fix where you are saying " SQL VALUES part of the line will be a syntax error"? Thank you for helping, John
  8. Hi All, I have built a form that shows up in my site until I add the php code below to inject it into my DB. As soon as I add the php for the injection I get a blank page. First of all please tell my why this is happening. Secondly please tell me if the way I am trying to write to my DB will work or not. This is loading in a page that already has a DB connection. If my injector is broken please tell me why. Okay to start with here is my table structure. websites: website_id is Primary customers_id is Index url description keywords <form method="POST"> <br><br>Your Website URL <br><br><input name="websiteUrl" type="text" size="40" maxlength="200"> <br><br>Keywords you would like help ranking for: <br><br><input name="keywords" type="text" value="Keyword, Keyword" size="40" maxlength="200"> <br><br>Enter a description of your website: <textarea name="description" cols="60" rows="4">Description of your website here. . .</textarea> <br><br> <input type="submit" name="send" value="Submit"/> </form> <?php $clientCustomersID = $_SESSION['customer_id']); $websiteURL = serialize($_POST['websiteUrl']); $keywords = serialize($_POST['keywords']); $description = serialize($_POST['description']); //Inject Customers website into client side DB if($_SERVER['REQUEST_METHOD']=='POST') { $qur="INSERT INTO websites (`customers_id`,`url`,`keywords`,`description`)values ('$clientCustomersID,$websiteURL,$keywords,$description')"; } ?> Thanks in advance, John <--- Super Newb!
  9. Okay! Got that too! single quotes not double. and I had to include this file above the doc type in my html_header.php not below the metas! Redirect on choice of no works and remove ip from db and redirect to homepage works on choice of yes. HELL YEAH! Thanks to all of you for your time. Also for putting up with this super newb! John
  10. I made it delete the IP from the DB!!!!!! Ha Ha! Still doesn't redirect with header("Location: http://www.google.com"); or header("Location: http://www.mydomain.com");tho. Please tell me why. <?php $myQuery = mysql_query("SELECT `banip` FROM `banedIPS`"); if(!$myQuery) { die("Database table Selection Failed: " . mysql_error()); } while ($row = mysql_fetch_assoc($myQuery)) { if($row['banip'] == $_SERVER['REMOTE_ADDR']) { if(!isset($_POST['submit'])){ echo "<form method=\"post\">"; echo "Are you a human?<br />"; echo "<select name=\"humancheck\">"; echo "<option value=\"no\">No</option>"; echo "<option value=\"yes\">Yes</option>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />"; echo "</select></form>"; } //$check = $_POST['humancheck']; if($_POST['humancheck'] == "no"){ header("Location: http://www.google.com"); } esleif($_POST['humancheck'] == "yes"){ mysql_query("DELETE FROM `banedIPS` WHERE `banip` = '".$_SERVER['REMOTE_ADDR']."'"); header("Location: http://www.mydomain.com"); } } } ?>
  11. It does kinda work. If your ip is in my db list then you see the form if your ip is not in the list you don't see the form. The problem is when you do see the form and you make a selection nothing happens that's supposed to happen. The form simply goes away and lets you continue browsing. If you select no from the drop you should be taken to google but that doesn't happen. If you select yes then your IP should be removed from the db. Doesn't happen.
  12. its only supposed to delete your ip from the db when you select "yes" that you are a human. I didn't catch the $_GET REMOTE_ADDR. I did change it to $_SERVER but still the form doesn't remove anything from the db. If you select no you should be directed to google. if you select yes then your ip should be removed from the db and be redirected to my main page where you wouldn't see the form again because your ip has been removed from the db. Thanks , John
  13. This form will not redirect or update the db. What is wrong with it? <?php $myQuery = mysql_query("SELECT `banip` FROM `banedIPS`"); if(!$myQuery) { die("Database table Selection Failed: " . mysql_error()); } while ($row = mysql_fetch_assoc($myQuery)) { if($row['banip'] == $_SERVER['REMOTE_ADDR']) { if(!isset($_POST['submit'])){ echo "<form method=\"post\">"; echo "Are you a human?<br />"; echo "<select name=\"humancheck\">"; echo "<option value=\"no\">No</option>"; echo "<option value=\"yes\">Yes</option>"; echo "<input type=\"submit\" name=\"submit\" value=\"Submit\" />"; echo "</select></form>"; }else{ $check = $_POST['humancheck']; if($check == "no"){ header("Location: http://www.google.com"); }elseif($check == "yes"){ mysql_query("DELETE FROM `banip` WHERE `banip` = '".$_GET['REMOTE_ADDR']."'"); header("Location: http://www.mydomain.com"); } } } } ?> Thank you, John
  14. Argggg. I cant seem to get this to do what I want. I'm hacking away at this but cant make it work. I am trying to get this {exit;} in there to where after the form is displayed the visitor would see nothing until the question is answered. Everything I try either blocks the ip all together like the original or just breaks. This is driving me crazy. Is there something other than {exit;} that I should be using here? Thanks, John
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.