Jump to content

$php_mysql$

Members
  • Posts

    391
  • Joined

  • Last visited

    Never

Everything posted by $php_mysql$

  1. mate i tried like u said and tried to echo the var $inserted_id but nothing shows, and im kinda not sure return what value?
  2. Yes you are right it has a AUTO_INCREMENT field, so it should be something like this? function insert($postData) { $postData['description'] = clean($postData['description']); if(!EmailExists($postData['email'])){ $sql = " INSERT INTO tbl_emails SET email = '".$postData['email']."', postersname = '".$postData['postersname']."', phone = '".$postData['phone']."' "; executeSql($sql); } if(empty($_FILES['image']["name"])){ $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['location']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; $inserted_id = mysql_insert_id();////Does this give me the id now? executeSql($sql); }else{ global $uploadPath; $remove_symbols = array('+', '=', '-', '{', '}', '$', '(', ')','&'); $removed_symbols = str_replace($remove_symbols, "_", $_FILES['image']['name']); $randomnum=rand(00000000,99999999); $imagepath = uploadFile($_FILES['image'], $uploadPath); $image = new SimpleImage(); $image->load($imagepath); $image->resize(250,280); $resize_rename = $uploadPath.$randomnum._.$removed_symbols; $image->save($resize_rename); unlink($imagepath); //delete the original file $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '".$resize_rename."', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['ocation']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; $inserted_id = mysql_insert_id();////Does this give me the id now? executeSql($sql); } }
  3. no i have not, could you please guide me with the usage of this function according to my function please?
  4. guys this function below posts the data into table and im also able to send a link in email with caregory name but the issue is getting the id to the particular post i got no isea how do i get that? function insert($postData) { $postData['description'] = clean($postData['description']); if(!EmailExists($postData['email'])){ $sql = " INSERT INTO tbl_emails SET email = '".$postData['email']."', postersname = '".$postData['postersname']."', phone = '".$postData['phone']."' "; executeSql($sql); } if(empty($_FILES['image']["name"])){ $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['location']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); }else{ global $uploadPath; $remove_symbols = array('+', '=', '-', '{', '}', '$', '(', ')','&'); $removed_symbols = str_replace($remove_symbols, "_", $_FILES['image']['name']); $randomnum=rand(00000000,99999999); $imagepath = uploadFile($_FILES['image'], $uploadPath); $image = new SimpleImage(); $image->load($imagepath); $image->resize(250,280); $resize_rename = $uploadPath.$randomnum._.$removed_symbols; $image->save($resize_rename); unlink($imagepath); //delete the original file $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '".$resize_rename."', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['ocation']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); } }
  5. i wish to add an loading image before the random.php displays content, how to do it? <script type="text/javascript"> function getHTTPObject(){ if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP"); else if (window.XMLHttpRequest) return new XMLHttpRequest(); else { alert("Your browser does not support AJAX."); return null; } } var inc=0; function callPHP(){ httpObject = getHTTPObject(); if (httpObject != null) { httpObject.open("GET", "http://localhost/script/random.php", true); httpObject.send(null); httpObject.onreadystatechange = setDiv; } setTimeout("callPHP()", 5000); } function setDiv(){ if(httpObject.readyState == 4){ document.getElementById('oPut').innerHTML = httpObject.responseText; } } window.onload=callPHP; </script>
  6. so im trying to display error message which is (Error!</font> Currently no updates available.) if nothing from the url returns but all i see is the error message when i try to check for error the data which is available does not show. why so? function weather(){ $ch = curl_init("http://www.domain.com/weather.html"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if(curl_errno($ch)){ $page = curl_exec($ch); preg_match('#<table[^>]*>(.+?)</table>#is', $page, $matches); foreach ($matches as &$match) { $match = $match; } echo '<table height=\"200px\">'; echo $matches[1]; echo '</table>'; }else{ echo "<table>"; echo "<tr>"; echo "<td>"; echo '<font align="center" color="red">Error!</font> Currently no updates available.'; echo "</td>"; echo "</tr>"; echo "</table>"; } }
  7. hi i wanted to compress my files so i googled and found this <IfModule mod_deflate.c> <FilesMatch "\.(css|js|x?html?|php|png|gif|jpeg|jpg)$"> SetOutputFilter DEFLATE </FilesMatch> </IfModule> it did compress my files but now after that my google +1 button will not show up anymore
  8. hey all now im new to gzip got not much knowledge on it. i was testing my site in seositecheckup and according to the test im asked to compress my html, css and js files and i found this bit of coding on google <?php if(isset($_SERVER['HTTP_ACCEPT_ENCODING']) && substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start('ob_gzhandler'); else ob_start(); ?> i included this file on top of my pages and then it seemed to compress my my file but it seem we need to set header expire on gzip so how could i set expire on it and could someone tell me what exactly is this coding above compressing i mean is it compressing image and all type of files?
  9. oh but i did not che4ck this category and my thread was in misc and later it was shifted so how was i to know?
  10. now confused. was this topic already created earlier by someone? ah then np delete it cheers \m/
  11. i tried to donate but since my paypal not verified and also they made new rule that unverified users from india cannot receive or send money :-D all me money stuck lmao.
  12. like the topic says, could someone point me to a bbcode function in php which i could use for my site? i needed something like , [code=php:0], [quote], [color], [url], [image] and [youtube]..... searched in google but no luck.
  13. thanks josh for agreeing to it :-) looking forward to seeing a lil like or best reply button on freaks soon :-) \m/ love all the guys here even if some are rude, have learned alot in this great forum :-)
  14. I don't think i'm sending the headers properly or something. My godaddy mail is only output the text as code and gmail doesn't even receive the email at all. $headers = "From: Mysite <noreply@mysite.com>\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; $body = <<<BODY //stuff BODY; mail($mail, "Closed Beta Invitation from {$ref_info['displayName']}", str_replace(array('<[key]>', '<[ref_name]>', '<[ref_uname]>'), array($data[0]["key"],$ref_info['displayName'], $ref_info['username']), $body), str_replace('<[mail]>', $mail, $headers)); you are missing reply-to and return-path in headers
  15. ah solved solution my function ////////////////////////////////////Check function detailsCheck($id) { $id = ""; $sql =" SELECT category FROM tbl WHERE id='$id'"; $rs = executeSql($sql); $id = mysql_fetch_array($rs); return $id[0]; } and did a check if(detailsCheck($ID) !== $cat){ header("location: index.php"); } :-) cheers, thanks again \m/
  16. yes that i know but how will i check if $cat exist in $ID if not headers elsewhere?
  17. ok help required how am i to check if $cat = clean($_REQUEST['Category']); which is Love as in Category=Love?ID=1 the name Love exist in database with the following id 1? the db structure is like id image title category time $cat = clean($_REQUEST['Category']); $ID = clean($_REQUEST['ID']);
  18. oh no its getting details just by the id. do i recommend also getting the category name?
  19. oh i was grabbing it like this $cat = clean($_REQUEST['Category']); $ID = clean($_REQUEST['ID']); and for querying the database i made a function and i fetch it by the id which come along with the url over all it looked like this $cat = clean($_REQUEST['Category']); $ID = clean($_REQUEST['ID']); $details = getDetails($ID);// the query in the function is like select from tbl as d where d.id=$ID
  20. ah got the solution L-) $match_link = array("Love","Hate"); if (!in_array($_REQUEST['Category'],$match_link)){ header("location: index.php"); } works great :-)
×
×
  • 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.