Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

snowdog's Achievements


Member (2/5)



  1. Update: I have completed my php code that ajax will access. I have read tutorials out the wazoo and think I have come up with my ajax call. I need to populate a new drop down with the returned code from the php file. Having a hard time understanding how to get the information out of the returned array and jsdon decoded no to loop through the information and create the drop downs I guess with javascript now? Here is the code so far: Jquery ajax function: <script id="source" language="javascript" type="text/javascript"> jQuery(function () { //----------------------------------------------------------------------- // 1) Send a http request with AJAX //----------------------------------------------------------------------- jQuery.ajax({ url: 'ajax/appointment_ajax_1.php', //the script to call to get data data: "dealer_id = " + jQuery('dealer_id').val(), //you can insert url argumnets here to pass to api.php //for example "id=5&parent=6" dataType: 'json', //data format success: function(data) //on recieve of reply { var first = data[0]; //get firstname var last = data[1]; //get lastname var id = data[2]; //get id //-------------------------------------------------------------------- // 2) Update Dealer's Staff Select Box //-------------------------------------------------------------------- jQuery('#output').html("<option name = 'name' value = "+id+">"+first+" "+last"</option>"); //Set option value and display } }); }); </script> And here is the php file: <?php //-------------------------------------------------------------------------- // php/ajax script for onchange from add appointments //-------------------------------------------------------------------------- session_start(); //-------------------------------------------------------------------------- // 1) Connect to mysql database //-------------------------------------------------------------------------- include("../include/db_connect.php"); //-------------------------------------------------------------------------- // 2) Query database for data //-------------------------------------------------------------------------- // Create container array $dealer_staff_array = array(); $franchise_id = $_SESSION['franchise_id']; $dealer_id = $_POST['dealer_id']; $SQL = "SELECT * FROM login WHERE franchise_id = '$franchise_id' and dealer_id = '$dealer_id' ORDER BY name ASC"; $result = mysql_query($SQL) or die(mysql_error()); while($row = mysql_fetch_array($result)) { //-------------------------------------------------------------------------- // 3) echo result as json string //-------------------------------------------------------------------------- $response = array( 'first' => $row['first'], 'last' => $row['last'], 'id' => $row['id'] ); array_push($dealer_staff_array, $response); } echo json_encode($response); ?> Any help would be appreciated. Thanks Snowdog
  2. I have a dealers select box that when I select it, I then want to load the dealers staff names into the next select box. I have been reading and I have this as the progress in my head. on submit, the ajax needs to send over the dealer_id to a php file that will then do a database query to get the staff members of that dealer_id and send the name and staff_id back to the html page to populate the dealers_staff select box. Once that is done it needs to do it all over again to get the dealers_staff member's name, email address and contact numbers to ill in some text boxes. So I think I understand what has to happen just don't know what to do to make it happen now. Thanks Snowdog
  3. so stupid, the second I had it as $nbsp; always something stupid I over look. Thanks Everyone.
  4. 108 while($run = mysql_fetch_array($result)) 109 { 110 111 echo("<tr><td> $run['vinNumber'] </td><td> $run['carYear'] $nbsp; $run['carModel'] </td><td><img src='franchises/franchise_id_{$franchise_id}/lotImages/dealer_id_{$dealer_id}/lot_id_{$run['id']}/wheelFL.jpeg'></td></tr>"); 112 113 }
  5. Here is my error: Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /var/www/vhosts/bookawrs.com/httpdocs/lot.php on line 111 Here is part of the code giving me the problems $SQL = "SELECT * FROM lot WHERE franchise_id = '$franchise_id' and dealer_id = '$dealer_id' ORDER BY id ASC"; $result = mysql_query($SQL) or die(mysql_error());[/size][/font][/color] [color=#000000][font='Times New Roman'][size=1]while($run = mysql_fetch_array($result)) {[/size][/font][/color] [color=#000000][font='Times New Roman'][size=1]echo("<tr><td> $run['vinNumber'] </td><td> $run['carYear'] $nbsp; $run['carModel'] </td><td><img src='franchises/franchise_id_{$franchise_id}/lotImages/dealer_id_{$dealer_id}/lot_id_{$run['id']}/wheelFL.jpeg'></td></tr>");[/size][/font][/color] [color=#000000][font='Times New Roman'][size=1]}
  6. I have to display 4 images in a table. The images are held in a directory structure that goes like this: franchises\franchise_id_1\lotImages\dealer_id_1\lot_id_1\wheelFL.jpeg Each 1 is actually a variable that comes from the database and depends on what dealer and franchise is logged in. Here is how I would write it: I can only assume it is not the proper way to do it. Any suggestions on the proper way to write something like this? <?php echo("<tr><td> $run['vinNumber'] </td><td> $run['carYear'] $nbsp; $run['carModel'] </td><td><img src='franchises/franchise_id_."$franchise_id"./lotImages/dealer_id_."$dealer_id"./lot_id."$run['id']".wheelFL.jpeg'></td></tr>"); ?>
  7. I don't mind paying if it is good. I see it has a 30 day trial, will give it a shot thanks. I am self taught and need to update my coding skills now with the new release of php for sure. Thanks for all of your help. I will be posting another problem I am having as I cannot find the proper way to do this so check it out
  8. Thanks scootstah, do you have any suggestions for a good one? I use cute ftp as I can edit and upload in the same program.
  9. how is the data input into the database? Is someone inputting the data and hitting a submit button?
  10. I cannot see the error for the life of me. I know it is going to be a simple one. Always is when I cant see it. Here is the error Parse error: syntax error, unexpected $end in /var/www/vhosts/bookawrs.com/httpdocs/lot.php on line 138 and the code <? include("include/db_connect.php"); session_start(); include("header.php"); include("search.php"); include("top_menu.php"); include("left_menu.php"); ?> <div class="maincontent"> <div class="breadcrumbs"> <a href="dashboard.html">Dashboard</a> <span>Table Styling</span> </div><!-- breadcrumbs --> <div class="left"> <h1 class="pageTitle">Table Styling</h1> <? if($_SESSION['dealer_id'] != 0) { if(isset($_SESSION['dealer_id'])){ { echo(" I AM HERE IN DEALER SECTION"); $dealer_id = $_SESSION['dealer_id']; } } else { // This is an Franchise, get the list of dealers $franchise_id = $_SESSION['franchise_id']; $SQL = "SELECT * FROM dealers WHERE franchise_id = $franchise_id ORDER BY name ASC"; $result = mysql_query($SQL) or die(mysql_error()); ?> <select> <option>Select Dealer</option> <? while($run = mysql_fetch_array($result)) { ?> <option value = "<?php echo $run['id'];?>"><?php echo $run['name'];?></option> <? } ?> </select> <? } ?> <div class="sTableOptions"> <h4>Cars on Lot</h4> </div><!--sTableOptions--> <table cellpadding="0" cellspacing="0" class="sTableHead" width="100%"> <colgroup> <col class="head1" width="25%" /> <col class="head0" width="25%" /> <col class="head1" width="15%" /> <col class="head0" width="10%" /> <col class="head1" width="10%" /> <col class="head0" width="15%" /> </colgroup> <tr> <td>Vin Numner</td> <td>Year Model</td> <td>Left Front</td> <td>Right Front</td> <td>Left Rear</td> <td>Righ Rear</td> </tr> </table> <div class="sTableWrapper"> <table cellpadding="0" cellspacing="0" class="sTable" width="100%"> <colgroup> <col class="con1" width="25%" /> <col class="con0" width="25%" /> <col class="con1" width="15%" /> <col class="con0" width="10%" /> <col class="con1" width="10%" /> <col class="con0" width="15%" /> </colgroup> <? // Get the cars that are on the lot from the dealer being called $SQL = "SELECT * FROM lot WHERE franchise_id = $franchise_id and dealer_id = $dealer_id ORDER BY date ASC"; $result = mysql_query($SQL) or die(mysql_error()); while($run = mysql_fetch_array($result)) { ?> <tr><td><?php echo $run['vinNumber'];?></td><td><?php echo $run['carYear'];?> $nbsp;<?php echo $run['carModel'];?></td><td><img src="">pic 1</td><td><img src="">pic 2</td><td><img src="">pic 3</td><td><img src="">pic 4</td></tr> <? } ?> </table> </div><!--sTableWrapper--> <br /> </div><!--left--> <br clear="all" /> </div><!--maincontent--> <? include("footer.php"); ?>
  11. I want the submit button to disappear after it has been clicked. Guys are too impatient and it is inputting multiple database lines. Can I use javascript to make the button disappear on click? Snowdog
  12. Stupid me, the , needs to be AND . Solved Snowdog
  13. My eyes just don't see it. I am sure it is simple and stupid. Here is the code and error $query_check = "select * from spares where level = '$level', skill = '$skill', date = '$date', time = '$game_time', team = '$team_name', position = '$position', player_id = '$player_id'"; $result_check = mysql_query($query_check) or die('Query failed: ' . mysql_error()); Query failed: 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 ' skill = 'b', date = '2013-02-24', time = '8:30', team = '8', position = 'f', pl' at line 1 Thanks Snowdog
  14. I will try to explain this and make it simple. I am having a iphone app and I have been able to interact with it no problems until it comes down to the file upload now. I have never done file uploads from a form before. There could be anywhere from 1-4 pictures and it will be: 4 $_FILES in a photos[] array, with the file names: wheelFL.jpeg wheelFR.jpeg wheelRL.jpeg wheelRR.jpeg Here is the code I have written so far, the files need to be uploaded to a directory called franchises/1 // SEND API if ( isset($_POST["send"])) { $dealer = $_POST['dealer']; $vinNumber = $_POST['vinNumber']; $carMake = ['carMake']; $carModel = ['carModel']; $carYear = ['carYear']; $franchise_id = $_SESSION['franchise_id']; // INSERT THE INFO INTO THE LOT DATABASE $SQL = "INSERT INTO lot (franchise_id,dealer_id,vinNumber,carMake,carModel,carYear,created,modified) VALUES ('$franchise_id','$dealer_id','$vinNumber','$carMake','$carModel','$carYear',NOW(),NOW())"; $result = mysql_query($SQL) or die('Query failed: ' . mysql_error()); $lot_id = mysql_insert_id(); // UPLOAD THE PICTURES OF THE RIMS } I am feeling completely lost on the file upload thing here. Thanks for any help. Snowdog
  • 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.