Jump to content

klepec

Members
  • Posts

    45
  • Joined

  • Last visited

Everything posted by klepec

  1. I have an url, for example: $test = mysql_real_escape_string($_GET['value']); I require this variable $test after the submit button is pressed, but the url does not keep it anymore. (../page.php). Is there a way i could keep it after the submit? if (isset($_POST["Submit"])) { operating with $test... } form...
  2. Okay, ill try to fix and improve all the things you suggested. Thanks )
  3. All that code i posted is an include of original form php. $cID is GET from the URL. (?cid) <?php include "header.php"; $cID = mysql_real_escape_string($_GET['cid']); $con = mysql_connect("localhost","root",""); mysql_set_charset('utf8',$con); if(!$con) { die("Connection Error: ".mysql_error()); } mysql_select_db("avtost", $con); $persona=mysql_query("SELECT userID, cName, cMobile FROM bcompany WHERE companyID='1'"); while ($persono=mysql_fetch_array($persona)) { $persone = $persono["userID"]; $cName= $persono["cName"]; $cMobile=$persono["cMobile"]; } if ($persone!=$uid) { echo "Do te strani nimate dostopa!"; exit; } if(isset($_POST["Potrdi"])) { include("addPoint.php"); } $getPlace= mysql_query("SELECT placeID FROM bplace"); mysql_close($con); ?> HTML .....
  4. Hello. I have written this script where user restaurant owner can add his place to the database of all local restaurants. (insert basic information into database, add up to 3 images, thumbnail creation, insert image information to database). It works well on localhost, but i would like some suggestions for improvement. Im not very sure of its structure, it may not execute well once it is online. And i also think there are too many "IF's". But i really have no idea how to do it any other way. Thanks for all the suggestions. <?php if(!defined('PROTECTION') || constant('PROTECTION') != 'demover') { echo "fuck off intruder!"; exit; } $naziv = mysql_real_escape_string($_POST['Naziv']); $naslov = mysql_real_escape_string($_POST['Naslov']); $kraj = mysql_real_escape_string($_POST['Kraj']); $telefon = mysql_real_escape_string($_POST['Telefon']); $web = "http://www.".mysql_real_escape_string($_POST['Spletna']); $gm = mysql_real_escape_string($_POST['Lokacija']); //$gmaps = gmParse($gm); $gmaps = 10; $fill="INSERT INTO bpoint (sName, sAddr, placeID, sPhone, sWeb, sGMaps, companyID) VALUES ('$naziv','$naslov','$kraj','$telefon','$web','$gmaps','$cID')"; if (mysql_query($fill)) { $lastID=mysql_insert_id(); $path="./truck/".$cID."/".$lastID; $pname=$_FILES["pic"]["tmp_name"]; $num=0; if (count($_FILES["pic"]) && mkdir($path, 0777)) { include "thumbs.php"; foreach($pname as $imag){ $bname=date("YmdHis").$num; $num++; $finalpath=$path."/".$bname.".jpg"; $finalthumb=$path."/".$bname."_thumb.jpg"; if($imag!="") { if (move_uploaded_file($imag, $finalpath)) { make_thumb($finalpath,$finalthumb,150); mysql_query("INSERT INTO images (name, companyID) VALUES ('$finalpath', '$cID')"); } } } } unset($_FILES["pic"]); } else {die(mysql_error());} ?>
  5. Okay, ill do that. Thanks for all the help )
  6. I know :/ ... i do includes whenever i operate with the databases and forms. For example, there is a user form for storing company information and few company images. In original file i usually do the html (form), and submit button isset condition (PHP). In included file (PHP only) i operate with post variables, create thumbnails, save images, insert to database, select from database.... etc Then back in original file I usually print out database results, messages etc.
  7. What do you mean by that? Can you please suggest a better way of doing this? Thanks for the answers
  8. Ahaa, I understand now. It is because of two different options. $row["column_name"] or $row[number]. Thanks for the explanation
  9. I have a code where i include file (on submit). if isset(... include "example.php"; This example.php contains a variable $message which i later print in original code. How do i prevent getting undefined variable errors? (before submit button is pressed) Thanks
  10. Hello, This is my mysql search: $req="%".mysql_real_escap.......; "SELECT companyID, cName FROM bcompany WHERE companyID LIKE '$req' OR cName LIKE '$req' ORDER BY companyID LIMIT 10" For example my search ($req) is krneki. There is one record in database which matches the criteria. And the array is like: array 0 => string '7' (length=1) 'companyID' => string '7' (length=1) 1 => string 'krneki jao' (length=10) 'cName' => string 'krneki jao' (length=10) Is it ok that there are double values in array i fetch from mysql?
  11. Thank you for the explanation.
  12. Hello, First of all, thanks to both of you for taking your time to help me solve this out. @ragax: It works JUST with the given url. If i try to use something else, there is an error: Notice: Undefined offset: 0 in E:\stuff\www\test\test.php on line 22 Line 22: echo $m[0].'<br />'; @.josh: Works like a charm with any google maps link. Can you guys tell me what are the differences (advantages/disad.) between regex and non regex version. Are there any? Thanks
  13. Hello, Id like to know how to extract bold coordinates from this url (PHP). I have never done that kind of stuff before. Important: Not just this specific url, but all urls with different coordinates every time. http://maps.google.com/maps?q=46.055603,14.507732&num=1&t=m&z=12 Thanks in advance.
  14. Hello, Id like to know how to extract bold coordinates from this url (PHP). I have never done that kind of stuff before. Important: Not just this specific url, but all urls with different coordinates every time. http://maps.google.com/maps?q=46.055603,14.507732&num=1&t=m&z=12 Thanks in advance.
  15. Hehe okay I will do as you advise. Thanks for all the answers. )
  16. Aha okay i understand, What about just PHP submit where you check database for any rows containing "the input" (mysql "LIKE"). And a bit of ajax, just for the live refresh.
  17. Yes, I was talking about already generated content ( generating long <li> list of database records - using php and mysql ) which is later sliced to pages using AJAX. The only reason for that ( not using PHP ) is having a whole list of content, so my ajax instant filter could search through all the possible options. I now decided to use different method, which is filter searching through database itself. Someting like ajax autocomplete thingy but outside the input field.
  18. Is it smart to use ajax pagination for bulk databases? I have that cool fast jquery live search filter, but i am afraid i wont be able to use it with PHP pagination since (as far as i know) page content is generated (selected from database) every time you go to next page. Any suggestions?
  19. Is it smart to use ajax pagination for bulk databases? I have that cool fast jquery live search filter, but i am afraid i wont be able to use it with PHP pagination since (as far as i know) page content is generated (selected from database) every time you go to next page. Any suggestions?
×
×
  • 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.