Jump to content

Digiboy

Members
  • Posts

    29
  • Joined

  • Last visited

Everything posted by Digiboy

  1. found it, it was $new_service_no = '0') it was changing value to 0 so my validation was wrong. Thank you all again.
  2. I added this to add-services form not product; this is for services (They both have same issue) Array ( [product_no] => 951554 [item_price] => 55.00 [add-product] => )
  3. this is what I get Array ( [service] => 847153 [item_price] => 4.00 [add-service] => )
  4. Thank you If I put exit; it doesnt execute rest of page and about the query, I need to have seperate forms so call to action only happens to one of them forms at same time Checked all, i dont have any cookies, and database column is varchar 200 Main issue is not php becuase when I echo $new_product_no = mysql_real_escape_string($_POST['product_no']); echo"$new_product_no"; My echo result is 0, it passes it as zero to insert query
  5. Hi guys, I have written this code to insert shopping items in a database but recently when user adds an item, item code is inserted as 0, I have also my php error on but still cant not figure out why and this happens to both add-product and service posts. It inserts everything else correctly except product or service no Any advise or help is appreciated <?php include_once('includes/header.php'); ?> <?php $get_car_reg = mysql_real_escape_string($_GET['car']); $get_car_reg = mb_strtoupper($get_car_reg); $get_invoice = mysql_real_escape_string($_GET['invoice']); if (isset($_POST['delete'])) { $delete_current_item = mysql_real_escape_string($_POST['delete_me']); $delete = mysql_query("DELETE FROM items WHERE id='$delete_current_item'"); header("Location:generate_invoice.php?car=$get_car_reg&invoice=$get_invoice"); } if (isset($_POST['sp'])) { $final_total = mysql_real_escape_string($_POST['final_total']); $final_discount = mysql_real_escape_string($_POST['final_discount']); $final_invoice_sub = mysql_real_escape_string($_POST['final_sub_total']); $final_vat = mysql_real_escape_string($_POST['final_vat']); $final_total = $final_total - $final_discount; $select_current = mysql_query("SELECT * FROM invoices WHERE invoice_no='$get_invoice'"); if (mysql_num_rows($select_current) >= 1) { $update = mysql_query("UPDATE invoices SET invoice_no='$get_invoice', sub_total='$final_invoice_sub', vat='$final_vat', total='$final_total', discount='$final_discount' WHERE invoice_no='$get_invoice'"); } else { $insert = mysql_query("INSERT INTO invoices (invoice_no, sub_total, vat, total, discount) VALUES ('$get_invoice','$final_invoice_sub','$final_vat','$final_total','$final_discount')"); } if ($insert || $update) { header("Location: print.php?car=$get_car_reg&invoice=$get_invoice"); } } ?> <h2>Invoice</h2> <h3>Car Reg: <?php echo"$get_car_reg"; ?></h3> <? if (empty($get_car_reg) || empty($get_invoice)) { header("Location: create-customer.php"); } else { if (isset($_POST['add-product'])) { $item_price = mysql_real_escape_string($_POST['item_price']); $new_product_no = mysql_real_escape_string($_POST['product_no']); if (empty($new_product_no) || $new_product_no = '0') { echo"<div class='alert alert-error'>You need to select an item</div>"; } else { $insert = mysql_query("INSERT INTO items (invoice_no, item_no, item_type, price) VALUES ('$get_invoice','$new_product_no','Product','$item_price')"); echo"$new_product_no is"; // header("Location:generate_invoice.php?car=$get_car_reg&invoice=$get_invoice"); } } else { if (isset($_POST['add-service'])) { $item_price = mysql_real_escape_string($_POST['item_price']); $new_service_no = mysql_real_escape_string($_POST['service']); if (empty($new_service_no) || $new_service_no = '0') { echo"<div class='alert alert-error'>You need to select an item</div>"; } else { $insert = mysql_query("INSERT INTO items (invoice_no, item_no, item_type, price) VALUES ('$get_invoice','$new_service_no','Service', '$item_price')"); header("Location:generate_invoice.php?car=$get_car_reg&invoice=$get_invoice"); } } } } ///$query="SELECT sum(price) FROM Fuel"; ?> <div class="left-column"> <form class="form" action="" method='POST'> <div class="control-group"> <label>Select Service</label> <div class="controls"> <select name="service"> <option value="0">Select one</option> <?php $select_services = mysql_query("SELECT * FROM services"); while ($row = mysql_fetch_array($select_services)) { $service_name = $row['service_name']; $service_price = $row['service_price']; $service_no = $row['service_no']; echo"<option value='$service_no'>$service_name</option>"; } ?> </select></div></div> <input type="hidden" name="item_price" value="<?php echo"$service_price"; ?>"> <button type="submit" name="add-service" class="btn btn-primary">Add</button> </form> <hr/> <form class="form" action="" method="post"> <div class="control-group"> <label>Select Products</label> <div class="controls"> <select name="product_no"> <option value="0">Select one</option> <?php $select_products = mysql_query("SELECT * FROM products"); while ($row = mysql_fetch_array($select_products)) { $product_sku = $row['sku']; $product_price = $row['price']; $product_name = $row['product_name']; echo"<option value='$product_sku'>$product_name</option>"; } ?> </select></div></div> <input type="hidden" name="item_price" value="<?php echo"$product_price"; ?>"> <button type="submit" name="add-product" class="btn btn-primary">Add</button> </form> <hr/> </div> <div class="right-column"> <table class="table"> <thead> <tr> <th>#</th> <th>Item Type</th> <th>Item Name</th> <th>Item No</th> <th>Price</th> <th>Remove</th> </tr> </thead> <tbody> <tr> <?php $select = mysql_query("SELECT * FROM items WHERE invoice_no='$get_invoice'"); while ($row = mysql_fetch_array($select)) { $current_item_id = $row['id']; $current_item_type = $row['item_type']; $current_item_no = $row['item_no']; $current_item_price = $row['price']; $select_item_name = mysql_query("SELECT * FROM services WHERE service_no='$current_item_no'"); if (mysql_num_rows($select_item_name) == 1) { while ($row = mysql_fetch_array($select_item_name)) { $current_item_name = $row['service_name']; } } /// else { $select_item_name = mysql_query("SELECT * FROM products WHERE sku='$current_item_no'"); if (mysql_num_rows($select_item_name) == 1) { while ($row = mysql_fetch_array($select_item_name)) { $current_item_name = $row['product_name']; } } /// } echo" <tr> <td>$current_item_id</td> <td>$current_item_type</td> <td>$current_item_name</td> <td>$current_item_no</td> <td>&pound$current_item_price</td> <td><form method='post' action=''><input type='hidden' name='delete_me' value='$current_item_id'><input type='submit' class='btn btn-danger' name='delete' value='Delete'></form></td> </tr> "; } ?> </tbody> </table> <form method="post" action=""> <table class="table"> <thead> <tr> <th>Discount</th> <th>Subtotal</th> <th>Total</th> </tr> </thead> <tbody> <tr> <td><input type="text" name='final_discount' placeholder='2.99' class='input input-mini'/></td> <td><?php $subtotal = mysql_query("SELECT sum(price) FROM items WHERE invoice_no='$get_invoice'"); $invoice_sub = mysql_fetch_array($subtotal); echo"&pound$invoice_sub[0]"; ?> </td> <td><?php $vat_q = mysql_query("SELECT * FROM company_config WHERE id='1'"); while ($row = mysql_fetch_array($vat_q)) { $vat = $row['vat_percentage']; } $total_vat = $vat * $invoice_sub[0] / 100; $total = $total_vat + $invoice_sub[0]; echo"&pound$total"; ?></td> </tr> </tbody> </table> <input type='hidden' name='final_total' value='<?php echo"$total"; ?>'> <input type='hidden' name='final_sub_total' value='<?php echo"$invoice_sub[0]"; ?>'> <input type='hidden' name='final_vat' value='<?php echo"floor($total_vat)"; ?>'> <div class='btn-group'> <button class='btn btn-primary' name='sp' type='submit'>Save & Print</button> </div> </form> </div> <?php include_once('includes/footer.php'); ?>
  6. I have this in my header, its really strange driving me crazy
  7. Yeah I have it in header, haven't included header here but yes I do.
  8. Hi guys, im trying to send this email with attachment but it doesn't give me any error and it doesn't send any emails. I have echoed out send to address and have had added echo on every step to see where issue is but it passes everything and doesn't send anything. Can you please help, driving me nuts for last two days, <?php if (isset($_POST['work'])){ $email=mysql_escape_string($_POST['email']); $phone=mysql_real_escape_string($_POST['phone']); $myaddress=mysql_real_escape_string($_POST['address_1']); $city=mysql_real_escape_string($_POST['city']); $zip=mysql_real_escape_string($_POST['zip']); $country=mysql_real_escape_string($_POST['country']); $covering=mysql_real_escape_string($_POST['covering']); $signature=mysql_real_escape_string($_POST['signature']); $upload_name=$_FILES["upload"]["name"]; $upload_type=$_FILES["upload"]["type"]; $upload_size=$_FILES["upload"]["size"]; $upload_temp=$_FILES["upload"]["tmp_name"]; $to='roozbeh.jalali@me.com'; $fp = fopen($upload_temp, "rb"); $file = fread($fp, $upload_size); $file = chunk_split(base64_encode($file)); $num = md5(time()); $subject = 'Work wit us'; $message =" <html> <head> <title>Jobs</title> </head> <body> <p>Name: $signature</p> <p>Email: $email</p> <p>Phone: $phone</p> <p>Address: $myaddress</p> <p>City: $city</p> <p>Zip: $zip</p> <p>Country: $country</p> <p>Covering Note: $covering</p> </body> </html> "; $headers = "From: Work With us<".$email.">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: multipart/mixed; "; $headers .= "boundary=".$num."\r\n"; $headers .= "--$num\r\n"; $headers .= "Message-ID: <".gettimeofday()." TheSystem@".$_SERVER['SERVER_NAME'].">\r\n"; $headers .= "X-Mailer: PHP v".phpversion()."\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 8bit\r\n"; $headers .= "".$message."\n"; $headers .= "--".$num."\n"; $headers .= "Content-Type:".$upload_type." "; $headers .= "name=\"".$upload_name."\"r\n"; $headers .= "Content-Transfer-Encoding: base64\r\n"; $headers .= "Content-Disposition: attachment; "; $headers .= "filename=\"".$upload_name."\"\r\n\n"; $headers .= "".$file."\r\n"; $headers .= "--".$num."--"; mail($to, $subject, $message, $headers); fclose($fp); } ?> <form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" class="ddd" method="post" id="work" enctype="multipart/form-data"> <h1 class='titles-400'>Work with us</h1><br/> <h2 class="subheader">Submit Your CV</h2> <div class="control-group"> <label class="control-label" for="inputEmail">Full Name:</label> <div class="controls"> <input type="text" class="validate[required] text-input" name="signature"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Email</label> <div class="controls"> <input type="email" name="email" class="validate[required,custom[email]] text-input"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Phone:</label> <div class="controls"> <input type="text" class="validate[required] text-input" name="phone"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Address:</label> <div class="controls"> <input type="text" name="address_1" class="validate[required] text-input" /> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">City:</label> <div class="controls"> <input type="text" class="validate[required] text-input" name="city"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Zip / Postal Code:</label> <div class="controls"> <input type="text" class="validate[required] text-input" name="zip"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Country:</label> <div class="controls"> <input type="text" class="validate[required] text-input" name="country"/> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Covering Note:</label> <div class="controls"> <textarea class="validate[required] text-input span9" name="covering" rows="10"></textarea> </div> </div> <div class="control-group"> <label class="control-label" for="inputEmail">Upload CV</label> <div class="controls"> <input type="file" name="upload" id="file" class="validate[required]"> <span class="help-block">(Must be .doc, .docx, .pdf or .rtf and 1Mb or less)</span> </div> <label class="control-label" for="how">How did you hear about us?</label> <div class="controls"> <select name="how" class="validate[required]"> <option value="">- Please Select -</option> <option value="YouTube">YouTube</option> <option value="Facebook">Facebook</option> <option value="Twitter">Twitter</option> <option value="Friends">Friends</option> <option value="Search Engine">Search Engine</option> <option value="Email Campaign">Email Campaign</option> <option value="Other">Other</option> </select> </div> </div> <div class="control-group"> <div class="controls"> <button type="submit" class="btn btn-custom" name="work">Submit</button> </div> </div> </form> Thank you all in advance
  9. Hi guys, I am trying to send a html email via phpmail but keep receiving variables rather than data. $to = 'me@me.com'; // subject $subject = 'title'; // message $message =' <html> <head> </head> <body> <p>How you have been effected: $effected</p> <p>URL: $url</p> <p>Company: $company</p> <p>Position: $position</p> <p>Email: $email</p> <p>Alternative Email: $alt_email</p> <p>Phone: $phone</p> <p>Address: $address</p> <p>City: $city</p> <p>Zip: $zip</p> <p>Country: $country</p> <p>Website: $website</p> <p>Signature: $signature</p> </body> </html> '; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'From: Me <no-reply@me.com>' . "\r\n"; mail($to, $subject, $message, $headers); I have also keep changing ' to " this is what i keep getting no matter what How you have been effected: $effected URL: $url Company: $company Position: $position Email: $email Alternative Email: $alt_email Phone: $phone Address: $address City: $city Zip: $zip Country: $country Website: $website Signature: $signature Any ideas? Thanks all in advance
  10. sorry one more question, now if i want to present this as a url then what i need to do? doing below put them all in one link echo'<a href="../actors/index.php?name='.$actor_name.'">'.$actor_name.'</a>';
  11. You are an absolute hero dude, well done, worked like a charm
  12. Thanks but how? im almost new to php
  13. Did that and still get the same result $select_actors=mysql_query("SELECT * FROM actors_in_movies WHERE movie_ref='$movie_ref'"); if (mysql_num_rows($select_actors)>=1) { while ($row=mysql_fetch_array($select_actors)) { $actor_ref=$row['actor_ref']; $select_actor_name=mysql_query("SELECT * FROM actors WHERE actors_ref='$actor_ref' AND active='1'"); while ($row_actor=mysql_fetch_array($select_actor_name)) { $actor_name .= $row_actor['actors_name'] . ","; } $actor_name = substr(trim($actor_name), 0, -1); echo " $actor_name"; } }
  14. Hi guys, I have a very basic issue, Im trying to get these results (List all result with coma and delete last coma) like : actor 1, actor 2 My total entries are two in mysql but i get first result duplicated and no coma! This is my code, could you please help me spotting my mistake? Thank you all $select_actors=mysql_query("SELECT * FROM actors_in_movies WHERE movie_ref='$movie_ref'"); if (mysql_num_rows($select_actors)>=1) { while ($row=mysql_fetch_array($select_actors)) { $actor_ref=$row['actor_ref']; $select_actor_name=mysql_query("SELECT * FROM actors WHERE actors_ref='$actor_ref' AND active='1'"); while ($row_actor=mysql_fetch_array($select_actor_name)) { $actor_name.=$row_actor['actors_name'].","; $actor_name = substr(trim($actor_name), 0, -1); echo" $actor_name"; }}}
  15. hi guys, Im trying to calculate number of days and time passed a time stamp but I always get 0 do you know why? Am I making funny mistake again? date_bought= "2013-06-02 15:57:04"; $add_days = 7; $date= date('Y-m-d',strtotime( $date_bought) + (24*3600*$add_days)); $result_date= $date - $date_bought; echo"$result_date";
  16. Thanks, I noticed this, tried it with this $query1 = "SELECT * FROM $tableName WHERE name LIKE '%" . $get_name . "%' OR address_1 LIKE '%" . $get_location . "%' OR address_2 LIKE '%" . $get_location . "%' OR postcode LIKE '%" . $get_location . "%'"; but still the same.
  17. <?php include_once('includes/header.php'); ?> <div class="box"><div class="column-left"> <h1>Search result ...</h1> <?php $tableName="business"; $targetpage = "search.php"; $limit = 10; $get_name=mysql_real_escape_string($_GET['search_name']); $get_location=mysql_real_escape_string($_GET['search_location']); ///$query = "SELECT COUNT(*) as num FROM $tableName"; $query = "SELECT COUNT(*) as num FROM $tableName WHERE name LIKE '%" . $get_name . "%' OR address_1 LIKE '%" . $get_location . "%' OR address_2 LIKE '%" . $get_location . "%' OR address_3 LIKE '%" . $get_location . "%' OR town LIKE '%" . $get_location . "%' OR country LIKE '%" . $get_location . "%' OR postcode LIKE '%" . $get_location . "%' "; $total_pages = mysql_fetch_array(mysql_query($query)); $total_pages = $total_pages[num]; $stages = 3; $page = mysql_escape_string($_GET['page']); if($page){ $start = ($page - 1) * $limit; }else{ $start = 0; } // Get page data $query1 = "SELECT * FROM $tableName LIMIT $start, $limit"; $result = mysql_query($query1); // Initial page num setup if ($page == 0){$page = 1;} $prev = $page - 1; $next = $page + 1; $lastpage = ceil($total_pages/$limit); $LastPagem1 = $lastpage - 1; $paginate = ''; if($lastpage > 1) { $paginate .= "<div class='pagination capital'>"; $paginate .= "<ul>"; // Previous if ($page > 1){ $paginate.= "<li><a href='$targetpage?page=$prev'>previous</a></li>"; }else{ $paginate.= "<li><span class='disabled'>previous</span></li>"; } // Pages if ($lastpage < 7 + ($stages * 2)) // Not enough pages to breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<li><span class='current'>$counter</span></li>"; }else{ $paginate.= "<li><a href='$targetpage?page=$counter'>$counter</a></li>";} } } elseif($lastpage > 5 + ($stages * 2)) // Enough pages to hide a few? { // Beginning only hide later pages if($page < 1 + ($stages * 2)) { for ($counter = 1; $counter < 4 + ($stages * 2); $counter++) { if ($counter == $page){ $paginate.= "<li><span class='current'>$counter</span></li>"; }else{ $paginate.= "<li><a href='$targetpage?page=$counter'>$counter</a></li>";} } $paginate.= "..."; $paginate.= "<li><a href='$targetpage?page=$LastPagem1'>$LastPagem1</a></li>"; $paginate.= "<li><a href='$targetpage?page=$lastpage'>$lastpage</a></li>"; } // Middle hide some front and some back elseif($lastpage - ($stages * 2) > $page && $page > ($stages * 2)) { $paginate.= "<li><a href='$targetpage?page=1'>1</a></li>"; $paginate.= "<li><a href='$targetpage?page=2'>2</a></li>"; $paginate.= "..."; for ($counter = $page - $stages; $counter <= $page + $stages; $counter++) { if ($counter == $page){ $paginate.= "<li><span class='current'>$counter</span></li>"; }else{ $paginate.= "<li><a href='$targetpage?page=$counter'>$counter</a></li>";} } $paginate.= "..."; $paginate.= "<li><a href='$targetpage?page=$LastPagem1'>$LastPagem1</a></li>"; $paginate.= "<li><a href='$targetpage?page=$lastpage'>$lastpage</a></li>"; } // End only hide early pages else { $paginate.= "<li><a href='$targetpage?page=1'>1</a></li>"; $paginate.= "<li><a href='$targetpage?page=2'>2</a></li>"; $paginate.= "..."; $paginate.="</div>"; for ($counter = $lastpage - (2 + ($stages * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page){ $paginate.= "<li><span class='current'>$counter</span></li>"; }else{ $paginate.= "<li><a href='$targetpage?page=$counter'>$counter</a></li>";} } } } // Next if ($page < $counter - 1){ $paginate.= "<li><a href='$targetpage?page=$next'>next</a></li>"; }else{ $paginate.= "<li><span class='disabled'>next</span></li>"; } $paginate.= "<ul></div>"; } ?> <ul> <?php echo "<script type='text/javascript' src='lib/js/jquery.min.js'></script> <script type='text/javascript' src='lib/jquery.raty.min.js'></script>"; $rating_cnt = 0; while($row = mysql_fetch_array($result)) { $bus_name=$row['name']; $bus_address_1=$row['address_1']; $bus_address_2=$row['address_2']; $bus_address_3=$row['address_3']; $bus_town=$row['town']; $bus_country=$row['country']; $bus_postcode=$row['potscode']; $bus_tel=$row['tel']; $bus_website=$row['website']; $bus_video=$row['video_link']; $bus_about=$row['about']; $select=mysql_query("SELECT * FROM towns WHERE id='$bus_town'"); while($myrow=mysql_fetch_array($select)) {$new_town=$myrow['town'];} /////// echo " <div class='business_list'> <div class='business-bars light-blue'><div class='business-bar-txt'>$bus_name, $new_town</div></div> <div class='business-row'> <div class='business-vimeo'><iframe src='http://player.vimeo.com/video/$bus_video' width='150' height='150' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></span></div> <div class='business-about'>$bus_about</div> </div> <div class='row2'> <div class='bus_vote'>"; //////////////////// This is where rating should appear, table name is business $rating_cnt++; $total_rate = 0; $rating_qry = "SELECT * FROM business_rating WHERE bid='".$row['id']."'"; $rating_res = mysql_query($rating_qry) or die(mysql_error()); $count_rating = mysql_num_rows($rating_res); while($rating_row = mysql_fetch_array($rating_res)) { $total_rate += $rating_row['rate']; } if($count_rating!=0) $rating_score = round($total_rate/$count_rating); else $rating_score = 0; if(isset($_SESSION['account_no']) && $_SESSION['account_no']!='') { echo "<input type='hidden' id='prd_id_".$rating_cnt."' name='prd_id_".$rating_cnt."' value='".$row['id']."' /> <div id='business_rate_".$rating_cnt."'></div> <script type='text/javascript'> $(function() { $.fn.raty.defaults.path = 'lib/img'; $('#business_rate_".$rating_cnt."').raty({ path : 'lib/img', cancel : false, cancelOff: 'cancel-off-big.png', cancelOn : 'cancel-on-big.png', half : false, size : 24, score : ".$rating_score.", starHalf : 'star-half-big.png', starOff : 'star-off-big.png', starOn : 'star-on-big.png', click: function(score, evt) { var prd_id = $('#prd_id_".$rating_cnt."').val(); $.ajax({ type: 'POST', url: 'add_rate.php', data: { bid: prd_id, rating:score } }).done(function( msg ) { alert('You add rating on this business successfully.'); }); } }); }); </script>"; } else { echo "<div id='business_rate_".$rating_cnt."'></div> <script type='text/javascript'> $(function() { $.fn.raty.defaults.path = 'lib/img'; $('#business_rate_".$rating_cnt."').raty({ path : 'lib/img', cancel : false, cancelOff: 'cancel-off-big.png', cancelOn : 'cancel-on-big.png', half : false, size : 24, readOnly : true, score : ".$rating_score.", starHalf : 'star-half-big.png', starOff : 'star-off-big.png', starOn : 'star-on-big.png' }); }); </script>"; } ////////////////// echo" <div class='bus_address'><div class='business-bar-txt'>$bus_address_1, $bus_address_2</div></div></div></div> <div class='row3'> <div class='bus_phone'><div class='business-bar-txt business-margin-left'>$bus_tel</div></div> <div class='bus_website'><div class='business-bar-txt'><a href='$bus_website' target='_new'>$bus_website</a></div></div> <div class='btn-group booking-review-toolbar'> <a data-toggle='modal' href='#review' class='btn'>Reviews</a> <a href='$bus_website' target='_new' class='btn btn-danger'>Booking</a> </div> </div></div> "; } echo "<div class='results'>$total_pages Results</div>"; // pagination echo $paginate; ?> </ul> <div id="review" class="modal hide fade in" style="display: none; "> <div class="modal-header"> <a class="close" data-dismiss="modal">×</a> <h3>Reviews</h3> </div> <div class="modal-body"> <div class="fb-comments" data-href="" data-width="520" data-num-posts="10"></div> </div> <div class="modal-footer"> <a href="#" class="btn" data-dismiss="modal">Close</a> </div> </div> </div> <!-- end of column left ---> <div class="column-right"><?php include_once('includes/right-column.php');?></div> <?php include_once('includes/footer.php');?>
  18. Hi guys, I have a search result page where I user $_get to match result from my user search. What happens is no matter what I search for, always get the same result. I dont get any errors or warnings. I just cant put my head around it anymore, this is my first time writing a search function in php. Thanks you all in advance. This is my code, I also get al result using mysql_fetch_array $get_name=mysql_real_escape_string($_GET['search_name']); $get_location=mysql_real_escape_string($_GET['search_location']); $query = "SELECT COUNT(*) as num FROM $tableName WHERE name LIKE '%" . $get_name . "%' OR address_1 LIKE '%" . $get_location . "%' OR address_2 LIKE '%" . $get_location . "%' OR address_3 LIKE '%" . $get_location . "%' OR town LIKE '%" . $get_location . "%' OR country LIKE '%" . $get_location . "%' OR postcode LIKE '%" . $get_location . "%' ";
  19. sorry could you be a bit more specific? thank you
  20. Hi guys, I have a sub domain where files are in directories and this page list them however it seems it cant read files more than 2 gb, file is in directory and server company hasnt restricted anything, all i get is folder is empty, strange thing is when is uploading large files, it shows the file, but as soon as upload is finished it says folder is empty. I have also accessed the file directly and it works and sitting in my directory but wouldnt show on this php page, Please remember it reads any file up to this size with current code but nothing more than that! Thanks for looking at my code <? define("SITE_ROOT", "http://reels.domain.com/FTP_FILES/") ?> <!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" /> <?php include("filesize.php"); $logo = $_REQUEST['logo']; $com = $_REQUEST['com']; $loc = $com; $PATH = $_ENV['DOCUMENT_ROOT']; $d="/home/content/97/101644/html/reels/$com"; $ar=getDirectorySize($d); echo "<title>FTP Reels Viewer / $com / " . $ar['count'] . " files</title>";?> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery-backstretch/2.0.3/jquery.backstretch.min.js"></script> <link href="http://reels.domain.com/FTP_FILES/style.css" rel="stylesheet" type="text/css" /> <!--[if lte IE 6]> <link href="<? echo SITE_ROOT ?>styleie6.css" type="text/css" title="MSIE CSS patch" rel="stylesheet" /> <![endif]--> <style type="text/css"> /*<![CDATA[*/ div.c1 {text-align: center} /*]]>*/ </style> </head> <body> <img src="http://reels.domain.com/FTP_FILES/bg.jpg" alt="background image" id="bg" /> <div class="container"> <? ///if ($logo == "mc") { echo "<div id=\"mc-header\">"; echo "<p><a href=\"http://domain.com\" target=\"_blank\"><img src=\"" . SITE_ROOT . "logo_2.png\" alt=\"mc_logo\" border=\"none\"/></a></p>"; echo "</div>"; ///} ?> <div class="contentmc"> <div align="center"> <?php if ($com == "") { echo "there is an error, please re-check your link."; } else { $dir = opendir($d); #open directory if ($ar['count'] == "0"){ echo "sorry the folder is empty."; } else { while ($f = readdir($dir)) { #read one file name if ($f != "." && $f != ".." && $f != ".htaccess" && $f != "logo.png" && $f != "logo_2.png") { echo "<table width=\"500px\"><tr>"; $pieces = explode(".", $f); natsort($pieces); //sort($pieces, ksort($pieces)); if (!isset($pieces[1])) { echo "its a directory -->"; $nf = $_REQUEST['com']; $f = "" . $pieces[0]; }; echo "<td align=\"right\" width=\"250px\"> <a href=\"/$com/$f\" title=\"right click and save as to download " . $pieces[0] . "\">" . $pieces[0] . "</a> </td> <td align=\"left\" width=\"75px\"> (.". $pieces[1] .")<br /></td><td width=\"20px\"><a href=\"../$com/$f\" title=\"download this file\"><img src=\"" . SITE_ROOT . "black_down.png\" alt=\"download\" border=\"none\"></a></td>\n"; } echo "</tr></table>\n"; } echo "<br /><br />You are in the "; echo "<a href=\"\" title=\"$loc\">" . $loc . "</a>"; echo " directory"; echo "<br />"; echo "<p>Left click to view the files.</p>"; echo "<p>Right click to save them on your computer (hold down CTRL & click on a Mac). </p>"; } closedir($dir); ?> <p></div> </div> <div class="footer"><div class="footer-text"> <? echo "This folder is using a total of: ".sizeFormat($ar['size'])." and contains ".$ar['count']." files.<br /><br />"; ?> Please remember to download your files within 3 days, as it will automatically be removed after this period. | <a href="mailto:naz@madcowfilms.co.uk?subject=<?echo $com;?>%20error&body=please%20describe%20your%20error">support</a> </div></div> </div> <? } ?> <!-- OH GOOGIE --> </body> </html>
  21. Hi guys, I have been scratching my head all day long to resolve error division by zero in code below: any thoughts? Thank you <ul> <?php echo "<script type='text/javascript' src='lib/js/jquery.min.js'></script> <script type='text/javascript' src='lib/jquery.raty.min.js'></script>"; $rating_cnt = 0; while($row = mysql_fetch_array($result)) { $bus_name=$row['name']; $bus_address_1=$row['address_1']; $bus_address_2=$row['address_2']; $bus_address_3=$row['address_3']; $bus_town=$row['town']; $bus_country=$row['country']; $bus_postcode=$row['potscode']; $bus_tel=$row['tel']; $bus_website=$row['website']; $bus_video=$row['video_link']; $bus_about=$row['about']; $select=mysql_query("SELECT * FROM towns WHERE id='$bus_town'"); while($myrow=mysql_fetch_array($select)) {$new_town=$myrow['town'];} /////// echo " <div class='business_list'> <div class='business-bars light-blue'><div class='business-bar-txt'>$bus_name, $new_town</div></div> <div class='business-row'> <div class='business-vimeo'><iframe src='http://player.vimeo.com/video/$bus_video' width='150' height='150' frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></span></div> <div class='business-about'>$bus_about</div> </div> <div class='row2'> <div class='bus_vote'>"; $rating_cnt++; if(isset($_SESSION['account_no']) && $_SESSION['account_no']!='') { echo "<input type='hidden' id='prd_id_".$rating_cnt."' name='prd_id_".$rating_cnt."' value='".$myrow['prd_id']."' /> <div id='business_rate_".$rating_cnt."'></div> <script type='text/javascript'> $(function() { $.fn.raty.defaults.path = 'lib/img'; $('#business_rate_".$rating_cnt."').raty({ path : 'lib/img', cancel : false, cancelOff: 'cancel-off-big.png', cancelOn : 'cancel-on-big.png', half : false, size : 24, starHalf : 'star-half-big.png', starOff : 'star-off-big.png', starOn : 'star-on-big.png', click: function(score, evt) { var prd_id = $('#prd_id').val(); $.ajax({ type: 'POST', url: 'add_rate.php', data: { bid: prd_id, rating:score } }).done(function( msg ) { alert('You add rating on this business successfully.'); }); } }); }); </script>"; } else { $total_rate = 0; $rating_qry = "SELECT * FROM business_rating WHERE bid='".$myrow['prd_id']."'"; $rating_res = mysql_query($rating_qry) or die(mysql_error()); $count_rating = mysql_num_rows($rating_res); while($rating_row = mysql_fetch_array($rating_res)) { $total_rate += $rating_row['rate']; } $rating_score =round($total_rate/$count_rating); echo "<div id='business_rate_".$rating_cnt."'></div> <script type='text/javascript'> $(function() { $.fn.raty.defaults.path = 'lib/img'; $('#business_rate_".$rating_cnt."').raty({ path : 'lib/img', cancel : false, cancelOff: 'cancel-off-big.png', cancelOn : 'cancel-on-big.png', half : false, size : 24, readonly : true, score : ".$rating_score.", starHalf : 'star-half-big.png', starOff : 'star-off-big.png', starOn : 'star-on-big.png' }); }); </script>"; } ////////////////// echo" </div> <div class='bus_address'><div class='business-bar-txt'>$bus_address_1,$bus_address_2, $bus_address_1</div></div></div> </div> <div class='row3'> <div class='bus_reviews'></div><div class='bus_phone'></div><div class='bus_website'></div> </div> <!-- end of row --> "; } echo "<div class='results'>$total_pages Results</div>"; // pagination echo $paginate; ?> </ul>
  22. I dont understand, this is the code from here http://www.91weblessons.com/php-cookie-ajax-based-rating-script/
  23. Thanks but it is getting the click from database and I have changed all click fields to 1 so there is nothing equal to zero but still same result.
×
×
  • 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.