PHP - How To Extract Information From Array And Display It
I've been trying to get this to work for a few days now and can't seem to get anywhere with it! Any help is very much appreciated.
I am creating a number generator where the user is required to insert the maximum number and generate rate. Maximum number is the highest number that the script will go to, and generate rate is how many numbers should be created. When the script runs, the numbers are stored into a MySQL database. The MySQL database creates a unique ID number so it can be recalled at a later date. The user then needs to go to Sorting.php and selects the record they wish to use. The numbers from this record are then counted and then stored into an array. If the numbers 2,5,5,0,2,2,1,3,5,1 where generated, the output of this new array will be: [5] => 3 [3] => 1 [2] => 3 [1] => 2 => 1 (These arrays can be of any length) I now need to extract this data and show it on screen. I don't know how to approach it. Format example: Number 5 appears 3 times Number 3 appears 1 times Number 2 appears 3 times Number 0 appears 1 times Sorting.php <?php $db1 = new Number_Information(); $db1->openDB(); $sql = "select * from GeneratedNumber"; $result = $db1->getResult($sql); if (!$_POST) { //page loads for the first time ?> <form action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post"> Select the ID (If you have just generated a number, it will be the last one): <!--This is the drop down menu--> <select name="ID"> <?php while ($row = mysql_fetch_assoc($result)) { echo "<option value='{$row['ID']}'> {$row['ID']} </option>"; } ?> </select> <br /> <input type="submit" value="Continue" /> </form> <?php } else { $ID = $_POST['ID']; //This will contain the value that was selected in the drop down menu above. $result = mysql_query("SELECT NUMBERS2 FROM GeneratedNumber WHERE ID='{$ID}'"); //This tells the script to select NUMBERS2 contents which is assosiated with the ID. while ($row = mysql_fetch_array($result)) $NUMBERS2 = $row['NUMBERS2']; echo "$NUMBERS2"; //Testing reasons - remove it later. echo "<br />"; //same as above echo "$ID"; // as above. echo "<br />"; //as above //Convert NUMBERS2 back into an array when inserted into table from Generator.php $NUMBERS = explode(",", $NUMBERS2); // Counts how many times a number appears //******************************************************************************************************************* //IF ALL ELSE FAILS, REVERT BACK TO THIS. //print_r(array_count_values($NUMBERS)); //It will only print the statement, but gives you a good building block when things WILL go wrong. //******************************************************************************************************************* rsort($NUMBERS); print_r(array_count_values($NUMBERS)); (The questions when editing posts are hard. I've needed to Google both of them:() Similar TutorialsHi, I am very new to PHP and apologies if this question has already been answered in another thread.
I am trying to extract the information from one array into another when some search criteria is matched.
Here is an example array ($original):
Array ( [ 1234567 ] => Array ( [name] => john ) [ 3456 ] => Array ( [name] => johnny ) [ 45673 ] => Array ( [name] => james ) [ 987 ] => Array ( [name] => jamie ) [ 5628721 ] => Array ( [name] => Simon ))
So if I searched for the string john, jo, joh then the new array ($filtered) should be as follows:
Array ( [ 1234567 ] => Array ( [name] => john ) [ 3456 ] => Array ( [name] => johnny ))
I was trying to do this using array_search & preg_match but have been struggling.
Any help would be much appreciated!
Problem: "Warning: extract() expects parameter 1 to be array, null given in C:\x\xampp\htdocs\pages\user_personal.php on line 32" - error also found on lines 33 and 38. and none of the information is displayed. Goal: I'm trying to retrieve profile information and multiple user inserted pictures and display the pictures through a while loop from one query. <?php $query = 'SELECT u.name_id, i.bio, i.exhib, p.product_code FROM user u LEFT JOIN profile i ON u.name_id = i.name_id LEFT JOIN ecomm_products p ON u.name_id = p.product_code WHERE u.name = "' . mysql_real_escape_string($_SESSION['name'], $db) . '" and p.name = "' . mysql_real_escape_string($_SESSION['name'], $db) . '"'; $result = mysql_query($query, $db) or die(mysql_error()); extract($bio); //line 32 extract($exhib); //line 33 $odd = true; while ($row = mysql_fetch_array($result)) { echo ($odd == true) ? '<tr class="odd_row">' : '<tr class="even_row">'; $odd = !$odd; extract($rows); line 38 echo '<td><a href="' . $dir . '/' . $row['product_code'] . '.jpg">'; echo '<img src="' . $thumbdir . '/' . $row['product_code'] . '.jpg">'; echo '</a></td>'; echo '</tr>'; } echo "</table>"; echo "<p>"; ?> <ul> <li>Biography: <?php echo $bio; ?></li> <li>Exhibitions: <?php echo $exhib; ?></li> </ul> Hello I post this message because I am trying to extract information from a site that has the same system of visacentral, I cannot give access to this system because is in a Intranet, but the system is more or less the same that this site: visacentral.co.uk/ajax/ajax.visaPopup.php?passport_from=BOL&traveling_to[0]=BHS&traveling_for%5B0%5D=T&traveling_to%5B1%5D=&traveling_for%5B1%5D=&traveling_to%5B2%5D=&traveling_for%5B2%5D=&traveling_to%5B3%5D=&traveling_for%5B3%5D=&account_number=BRITTRAV&account_exists=N The problem that I have either I use CURL or file_get_contents then they have a redirection and I cannot get the final content from http://visacentral.co.uk/requirements.php Someone has any idea how this can be done? Thank you very much!! Hello, Anyone know a way I could extract information from YouTube. If I have the URL for the video, how could I get the title, runtime, tags and so on into different strings? url = "http://www.youtube.com/watch?v=kMAI26FPeyM"; Thanks I am new to coding and I am trying to write a simple business registration app. a foreach loop populates a select list and a nested loop checks to see if something new is being added. If so write to the DB. Great. Only part of it is working, I am getting the correct businessId but the categoryId is an array: 188 Array 189 Array 190 Array 191 Array 192 Array 195 Array 196 Array Here is the code: Code: [Select] <form method="post" action="?"> <table> <tr><td class="picklist"><?php echo $pickMessage; ?> <select name="bizCatSelect[]" size="4" multiple> <?php $sql = "SELECT categoryId FROM categories"; $sth = $dbh->prepare($sql); $sth-> execute(); $result = $sth->fetchAll(PDO::FETCH_COLUMN, 0); foreach($result as $value) { if($addRecord == 1) { $selected = false; if(in_array($value, $bizCatSelect)) // $row[1] { $sql = "INSERT INTO businessCat(businessId,categoryId) VALUES(:bizId, :bizCatSelect)"; $sth = $dbh->prepare($sql); $sth->bindValue(':bizId', $bizId, PDO::PARAM_STR); $sth->bindValue(':bizCatSelect', $bizCatSelect, PDO::PARAM_STR); $query = $sth->execute(); $params = array($bizId, $bizCatSelect); // $row[0] $value print_r($params); //$resp = $sth->execute($query, $params); echo "<option selected=\"$value\">$value</option>\n"; // $row[1] $selected = true; } if($selected == false){echo "<option value=\"$value\">$value</option>\n";} } else{ echo "<option value=\"$value\">$value</option>\n";} //echo "<option value=\"$value\">$value</option>\n"; } ?> </select> </td> <td class="addlist"> <table> <tr><td class="formLable">Business Name:</td> <td><input type="text" name="bizName" size="40" maxlength="255" value="<?php echo $bizName; ?>"></td> </tr> <tr><td class="formLable">Address:</td> <td><input type="text" name="bizAddress" size="40" maxlength="255" value="<?php echo $bizAddress; ?>" ></td> </tr> <tr><td class="formLable">City:</td> <td><input type="text" name="bizCity" size="40" maxlength="128" value="<?php echo $bizCity; ?>" ></td> </tr> <tr><td class="formLable">Telephone:</td> <td><input type="text" name="bizTele" size="40" maxlength="64" value="<?php echo $bizTele; ?>" ></td> </tr> <tr><td class="formLable">URL:</td> <td><input type="text" name="bizUrl" size="40" maxlength="255" value="<?php echo $bizUrl; ?>" ></td> </tr> </table> </td> </tr> </table> <p><input type="hidden" name="addRecord" value="1"> <?php if($addRecord == 1) {echo "<p><a href=\"?\">Add another business</a></p>";} else {echo "<INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"Add Business\">";} ?> </p> </form> I just can't seem to get this last part, any suggestions? AL I'd like some help debuging my code, I can't seem to figure out why it isn't creating the variables... Here it is: <?php $template_settings = array( "index"=>"index.php", "announcements"=>"announcements.php" ); extract($template_settings, EXTR_PREFIX_ALL, "template_"); echo $template_index; ?> No matter what I do $template_index still equals null and I'm wondering what I'm doing wrong. There are no errors of anykind. Hi - I have an array which is created from a session variable I must have constructed my array wrong, as for the life of me I can not extract the individual values. I have tried innumerable $key=>$value combinations. I must be doing something stupid, maybe it is obvious, but not to me. I'll be darn grateful if you can help me ! Many Thanks MY array looks like this: Code: [Select] Array ( [quantity] => Array ( [0] => 1 [1] => 1 [2] => 1 [3] => 1 [4] => 1 ) [name] => Array ( [0] => Ribs Large pack 20 pieces [1] => 25 Piece Bag [2] => Sirloin Steak [3] => 50 piece bag of Scalops [4] => Sirloin Steak ) [prodid] => Array ( [0] => 17 [1] => 28 [2] => 27 [3] => 25 [4] => 27 ) ) The CodeIgniter form which generated this array looks like this: Code: [Select] <?php foreach ( $_SESSION['openorders'] as $key=>$value) { ?> <tr align="center"> <td width="30"><?php $data=array('name' =>'quantity[]','value'=>$value['quantity']); echo form_input($data); ?></td> <td><?php echo $value['prodid']; ?></td> <td><?php echo $value['name'];?></td> <td><?php echo $value['ordervalue']; ?></td> <td><?php echo $value['pricelb']; ?></td> <td align="right"><?php echo form_checkbox('delete','delete',FALSE); echo form_hidden('prodid[]', $value['prodid']); echo form_hidden('name[]', $value['name']); echo form_hidden('orderid', $value['orderid']); $totalordervalue += $value['ordervalue']; } ?> I'm a newbie . I've been stuck on this error message for 2 days: I get this error message: extract() expects parameter 1 to be array, boolean given in C:\x\xampp\htdocs\user_personal.php on line 30 Code: [Select] <?php $query = 'SELECT about_me, job, hobbies, contact FROM site_user u JOIN site_user_profile p ON u.user_id = p.user_id WHERE username = "' . mysql_real_escape_string($_SESSION['username'], $db) . '"'; $result = mysql_query($query, $db) or die(mysql_error($db)); $row = mysql_fetch_array($result); extract($row); mysql_free_result($result); mysql_close($db); ?> I think joining table is hard, I just want to create a profile that would be linked to a user name. Please be my friend and help me so I can have PHP phun time. Hello everyone, I have been trying several things,recently, and I can't figure out how to get a series of numbers, grouped together as a string of number, instead of it adding or grabbing the last number that was randomly generated. I'm wanting to save it in a variable (of course), so I can pass it though a query when it is needed. foreach($array as $number){ echo $number; } $array is the variable where it is an array but all the randomly generated numbers are stored there. All / any help would be gratefully appreciated. My array is $arr = array( 'global' => array( array('tabs', 'tabs', 'tabs', array( 'Main' => 'main', 'Gallery' => 'galleryID', 'mera' => 'mera', )), array('main','div', 'div'), array('egice', 'Eice', 'text', '', ''), array('closeHere', 'closeHere', 'closeHere'), array('galleryID','div', 'div'), array('gallery', 'Gallery #1', 'image', '', ''), array('closeHere', 'closeHere', 'closeHere'), array('networking', 'div', 'div'), array('siLype', 'SiLype', 'text', '', ''), array('gpXCge', 'GpXCge', 'toggle_button', '1', 'Yes', 'No', ''), array('closeHere', 'closeHere', 'closeHere'), array('mera', 'div', 'div'), array('maimera', 'Maimera', 'repeatedText', 'resYI', 'GYL',''), array('closeHere', 'closeHere', 'closeHere'), array( 'moures','div', 'div'), array('meLmo', 'MeLmo', 'text', '', ''), array('cYSlot', 'CYSlot', 'text', '', ''), array('closeHere', 'closeHere', 'closeHere'), array('clT', 'clT', 'clT'), ), );
Simply, I want to split the main array to multiple arrays
I had tried here to do it but I can’t I have a function that is supposed to find the email address of the user that's logged in my application. going by their ID:
function getUserEmail($userID){ $sqll="SELECT id,email FROM users WHERE id='".$userID."'"; $result1=mysql_query($sqll); $row11=mysql_fetch_assoc($result1); $processor=$row11["email"]; return $processor; }What I'm trying to do is incorporate that into sending a simple email to the person that's logged in after they submit a file. But the email is not being sent and I'm getting this message: Warning: mail() expects parameter 1 to be string, array given Here is what I have for sending the email : $sendto = getUserInfo($_REQUEST[1][email]); $subject = "File recieved"; $message = "Hello " . getUser($_REQUEST["user"]) . ". you successfully submitted: $title"; mail($sendto, $subject, $message);How do I extract just the email address to prevent giving the array? Hi, So I am currently making a real estate site for my class at school but I am having a tiny issue with the listing display page. So what I want to do is show a bunch of listing that the agent owns on their dashboard which I have already done. Now I have two links one to update the listing and one to view the listing. Now what I am trying to do is when the view listing link is clicked it will take the user to the listing-display page and then I want it to display all the information for the listing that the link was clicked under. But i cannot for the life of me figure out how to do that!
This is currently the code for the dashboard where you only view the listing headline <?php // If the session was never set with a user id $output = ''; $conn = db_connect(); if($_SESSION['userType'] != AGENT) { $_SESSION['RedirectError'] = "You were not logged in as an Agent<br/>"; header("Location:login.php"); } if (isset($_GET["page"])) { $page = $_GET["page"]; $index = ($page -1) * IMAGE_LIMIT; } else { $page=1; $index = 0; } ?> <!-- start of main page content --> <div class="container" style="margin-top: 2em;"> <h2>Dashboard</h2> <p>Welcome back <?php echo $_SESSION['userId']; ?> you last logged in on <?php echo $_SESSION['last_access']; ?></p> <h4>Your Listings</h4> <?php $sql = "SELECT listing_id FROM listings WHERE user_id = '".$_SESSION['userId']."' AND status = 'o' ORDER BY listing_id"; $result = pg_query($conn, $sql); $listings = pg_fetch_all($result); for($index; $index < pg_num_rows($result); $index++) { $sql = "SELECT * FROM listings WHERE listing_id = '".$listings[$index]['listing_id']."'"; $listing_result = pg_query($conn, $sql); $arrayRow = pg_fetch_assoc($listing_result); echo (build_listing_card($arrayRow)); if($index !=0 && ($index +1) % IMAGE_LIMIT ==0){ break; } } ?> </div> <br/> <?php $total_pages = ceil(count($listings) / IMAGE_LIMIT); $pageLink = "<div class='pagination'>"; for ($i=1; $i<=$total_pages; $i++) { if($i == $page) { $pageLink .= "<a class='active' href='dashboard.php?page=".$i."'>".$i."</a>"; } else { $pageLink .= "<a href='dashboard.php?page=".$i."'>".$i."</a>"; } }; ?> </div> <br/>
and this is the code for the listing-display page where I want all the listing information to be displayed <?php if (isset($_GET['listing_id'])) { $_SESSION['listing_id'] = $_GET['listing_id']; } else { $_SESSION['listing_id'] = 0; echo "ERROR: listing information was not find"; } $sql = 'SELECT * FROM listings WHERE listing_id = ' . $_SESSION['listing_id']; echo "<BR>".$sql; $result = pg_query(db_connect(), $sql); $records = pg_num_rows($result); echo "<BR>".pg_fetch_result($result, 0, "listing_id"); echo "<BR>".pg_fetch_result($result, 0, "user_id"); echo "<BR>".pg_fetch_result($result, 0, "status"); echo "<BR>".pg_fetch_result($result, 0, "price"); echo "<BR>".pg_fetch_result($result, 0, "headline"); echo "<BR>".pg_fetch_result($result, 0, "description"); echo "<BR>".pg_fetch_result($result, 0, "postal_code"); echo "<BR>".pg_fetch_result($result, 0, "images"); echo "<BR>".pg_fetch_result($result, 0, "city"); echo "<BR>".pg_fetch_result($result, 0, "property_options"); echo "<BR>".pg_fetch_result($result, 0, "bedrooms"); echo "<BR>".pg_fetch_result($result, 0, "bathrooms"); echo "<BR>".pg_fetch_result($result, 0, "garage"); echo "<BR>".pg_fetch_result($result, 0, "purchase_type"); echo "<BR>".pg_fetch_result($result, 0, "property_type"); echo "<BR>".pg_fetch_result($result, 0, "finished_basement"); echo "<BR>".pg_fetch_result($result, 0, "open_house"); echo "<BR>".pg_fetch_result($result, 0, "schools"); ?> <h1> Listing Display </h1> <hr/> <table style="width:50%" border="1px solid black"> <tr> <th>Listing Image</th> <th>Listing Description</th> </tr> <tr> <th rowspan="2"> <img src="" alt="Oshawa House" width="300px" height="200px"/> </th> <td align="left" valign="top"> <h3><?php echo pg_fetch_result($result, 0, "headline") ?></h3> <ul> <li>Open house?: <?php echo get_property('open_house', pg_fetch_result($result, 0, "open_house"))?> </li> <li>Finished Basement?: <?php echo get_property('finished_basement', pg_fetch_result($result, 0, "finished_basement"))?></li> <li><?php echo get_property('purchase_type', pg_fetch_result($result, 0, "purchase_type"))?></li> <li>Garage Type: <?php echo get_property('garage_type', pg_fetch_result($result, 0, "garage"))?></li> <li>Near school?: <?php echo get_property('schools', pg_fetch_result($result, 0, "schools"))?></li> <li>Status: <?php echo get_property('listing_status', strtolower(pg_fetch_result($result, 0, "status"))) ?></li> <li>Washrooms: <?php echo get_property('washrooms',pg_fetch_result($result, 0, "bathrooms")) ?></li> <li>Bedrooms: <?php echo get_property('bedrooms',pg_fetch_result($result, 0, "bedrooms")) ?></li> <li>Description: <?php echo pg_fetch_result($result, 0, "description") ?></li> </ul> </td> </tr> <tr> <td align="left" valign="top"><ul> <li>Location: <?php echo get_property('cities',pg_fetch_result($result, 0, "city")) ?></li> <li>Postal Code: <?php echo pg_fetch_result($result, 0, "postal_code") ?></li> <li>Price: <?php echo pg_fetch_result($result, 0, "price") ?></li> </ul> </td> </tr> </table> <form action="listing-matches.php"> <p> <input type="submit" name="submit" value="Back"/></p> </form>
Hello, I recently came upon this website and I want to implement something similar. The 'remove' box is what I would like to do with PHP. I have no idea where to start. I would like to be able to search through my database, select one of its components and add it to that window. Within that window I would also like to be able to remove it. Does anyone know where I should go from there? here is the site: http://www.sealandserpent.org/schedgen/schedulegenerator.php 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 have a website that lists courses. I want each tutor to be able to add a piece of code that will display upcoming courses on their website. I am unsure of the best, secure way to do this. Could I simply create a file with a function and allow the tutor to add this to their site something like: <? include "http://www.mysite.com/showCourses.php?user=peterPan; ?> This showCourses.php would connect and query my database, would this work? Hi,
Webapp noob here.
I have an application that is going to be data-heavy, so I would like to avoid saving things to the database whenever possible. The application in a nutshell is an android application wired up to a php web app(with MySQL) where you can send requests to the phone and the phone will respond with text or image data with POST.
The normal way to do this would be for the phone to post the data to the database, then have the webapp display it. However, what im wondering is if it is possible for a user on the webapp to request information from the phone, and then when the phone replies using a POST to display the information temporarily in maybe a popup window instead of having to save it to the database.
Thanks!
This topic has been moved to Third Party PHP Scripts. http://www.phpfreaks.com/forums/index.php?topic=321546.0 Good afternoon,
I was wondering if you could help me out with a few things. I have created a registration page and it stores the information into my database. A success page then appears with some of the details they entered as a confirmation page. Unfortunately I cannot get the information to appear on the page. I have included some code, any help would be greatly appreciated.
<?php Hello my problem here is to have a drop down menu which gathers usernames from the database. Then with a click of a button the information for that specific user selected is shown. I'm close code wise but right now it's just showing me all users. I'm displaying the info in text box's to allow an admin to change the info.
<form action="edit.php" method="post"> <select name="username" id="username"> <?php // Connects to your Database $con=mysqli_connect('localhost', 'root', ''); /* check connection */ if (mysqli_connect_errno($con)) { trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR); } $query = "SELECT `username` FROM `bencobricks` . `users`"; $result = mysqli_query($con, $query) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($con), E_USER_ERROR); if($result) { while($row = mysqli_fetch_assoc($result)) { //printf ("%s\n %s\n ", echo "<label for='username'>Username: </label> <option value='$row[username]'>$row[username] </option><br/>"; echo "<br/><br/> "; } } mysqli_close($con); ?> </select> <br /> <input name="send" id="send" type="submit" value="Edit User" /> </form>Then in the edit.php file i have this code: <?php // Connects to your Database $con=mysqli_connect('localhost', 'root', ''); /* check connection */ if (mysqli_connect_errno($con)) { trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR); } if (isset($_POST['send'])) { $username = $_POST['username']; $query = "SELECT * FROM `bencobricks` . `users` "; $result = mysqli_query($con, $query) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($con), E_USER_ERROR); // Print the result if($result) { while ($row = mysqli_fetch_assoc($result)) { // $query = "SELECT * FROM `bencobricks` . `users` WHERE `username` = username = $row[username]"; printf ("%s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n %s\n", "<label for='username'>Username: </label> <input type='text' name='username' value='$row[username]'>" . "</input><br/>", "<label for='email'>Email: </label> <input type='text' name='email' value='$row[email]'>" . "</input><br/>", "<label for='membership'>Membership: </label> <input type='text' name='membership' value='$row[membership]'>" . "</input><br/>", "<label for='firstName'>First name: </label> <input type='text' name='firstName' value='$row[firstName]'>" . "</input><br/>", "<label for='lastName'>Last name: </label> <input type='text' name='lastName' value='$row[lastName]'>" . "</input><br/>", "<label for='gender'>Gender: </label> <input type='text' name='gender' value='$row[gender]'>" . "</input><br/>", "<label for='dateOfBirth'>Birthdate: </label> <input type='text' name='dateOfBirth' value='$row[dateOfBirth]'>" . "</input><br/>", "<label for='date'>Date: </label> <input type='text' name='date' value='$row[date]'>" . "</input><br/>", "<label for='sets'>Sets: </label> <input type='text' name='sets' value='$row[sets]'>" . "</input><br/>", "<label for='checkbox'>Checkbox: </label> <input type='text' name='checkbox' value='$row[checkbox]'>" . "</input><br/>", "<label for='admin'>Admin? </label> <input type='text' name='admin' value='$row[adminFlag]'>" . "</input><BR>", "<br/><br/> "); } } } mysqli_close($con); ?>Any help is greatly appreciated. |