PHP - Getimagesize Function Doesn't Work With Url Imagefile Ending On .jpg&size=40x30
Hello happy codes,
I have an image as such; http://storage.canoe.ca/v1/dynamic_resize/?src=http://www.torontosun.com/specialsections/2011/03/10/248x186_mb.jpg&size=40x30 getimagesize doesn't work with this image. Any ideas or links? I have looked through this site and can't find anyone having this problem. Am I missing something? Thank you, V. Similar TutorialsAll the tables are correct and it's making the connect to the database fine it's just not working, did I write it wrong? Code: [Select] function newPm($to, $from, $title, $text){ $q = $db->query("SELECT * FROM ibf_message_topics ORDER BY mt_id DESC"); $lastMsg = $db->fetch_assoc($q); $mid = $lastMsg['mt_id'] + 1; $msgId = $lastMsg['mt_msg_id'] + 1; $db->query("INSERT INTO ibf_message_topics SET mt_id=$mid, mt_msg_id=$msgId, mt_date=". time(). ", mt_title='$title', mt_from_id=$from, mt_to_id=". $to. ", mt_vid_folder='in', mt_read=0, mt_owner_id=$to, mt_user_read=0") or die(mysql_error()); $db->query("INSERT INTO ibf_message_text SET msg_id=$msgId, msg_date=". time() .", msg_post='$text', msg_sent_to_count=1, msg_author_id=$from") or die(mysql_error()); $userq = $db->query("SELECT new_msg FROM ibf_members WHERE id = $to"); $userData = $db->fetch_assoc($userq); $msgCount = $userData['new_msg'] + 1; $db->query("UPDATE ibf_members SET new_msg=$msgCount, show_popup=1 WHERE id = $to") or die(mysql_error()); } Here's how that function is being called in the beginning of the page: Code: [Select] if($action =="banUser"){ $expire = time() + (3600000 * 24 * $_GET['duration']); $q = $db->query("SELECT * FROM ibf_message_topics ORDER BY mt_id DESC"); $lastMsg = $db->fetch_assoc($q); $mid = $lastMsg['mt_id'] + 1; $msgId = $lastMsg['mt_msg_id'] + 1; $title = "Notification"; $duration = $_GET['duration'] ." days"; if($_GET['duration'] == "1"){ $duration = "1 day"; } if($_GET['duration'] == "Forever"){ $duration = "forever"; } $temp = 0; if($expire > time()){ $temp = 1; } $body = "This automated message has been sent to notify you that your account has been banned $duration. To appeal this ban, click on Irc from the menu on the homepage and ask to speak to a moderator. If this ban is temporary, your account will be reinstated automatically at the appropriate time"; newPm($id, 3017, $title, $body); $msgCount = $_GET['msg'] + 1; $db->query("UPDATE ibf_members SET ban_level = $level, tempbanned = $temp, banned = 1, ban_expire='$expire', ban_reason='". $_GET['reason']."', ban_by='". $name."' WHERE id=$id") or die(mysql_error()); ?> <center><b>User banned!</b> (<a href="index.php?code=plyrmgmt">Back to Player Management</a>)</center> I am attempting to build an online shopping cart, however I have a problem with the Delete /Remove Item function. Add New and Update Item work perfectly fine, just the Remove Item doesn't. It seems to be mirroring the same functionality as Update Item. http://www.tottonc.co.nz to see my problem in action. Any help or solutions would be much appreciated... Code: [Select] <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>----Index----</title> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } //--> </script> <link href="file:///H|/10109/10109/10109/WITHOUT_FLASH/style.css" rel="stylesheet" type="text/css"> </head> <body bgcolor="#ffffff" onLoad="MM_preloadImages('file:///H|/10109/10109/10109/WITHOUT_FLASH/images/l1-1.gif')"> <table width="766" style="height:100%" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td width="766" style="height:850px" valign="middle"> <table width="766" style="height:850px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="766" style="height:299px" valign="top"> <table width="766" style="height:299px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="45" style="height:299px" valign="top"></td> <td width="680" style="background-image: url(file:///H|/10109/10109/10109/WITHOUT_FLASH/images/fl.jpg); background-repeat: no-repeat; background-position:;height:299px" valign="top"> <table width="680" style="height:299px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="680" style="height:97px" valign="top"> <table width="680" style="height:97px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="537" style="height:97px" valign="top"> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/logo.jpg" style="margin-left:10px; margin-top:29px"><br> </td> <td width="143" style="height:97px" valign="top"> <a href="#"><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p-h.gif" style="margin-left:px; margin-top:55px"></a><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p-l.gif" style="margin-left:17px; margin-top:55px"><a href="#"><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p-m.gif" style="margin-left:17px; margin-top:55px"></a><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p-l.gif" style="margin-left:17px; margin-top:55px"><a href="#"><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p-s.gif" style="margin-left:16px; margin-top:55px"></a><br> </td> </tr> </table> </td> </tr> <tr> <td width="680" style="height:202px" valign="top"> <table width="680" style="height:202px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="238" style="height:202px" valign="top"> <?php include("menu.php"); ?> </td> <td width="442" style="height:202px" valign="top"> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/slogan.jpg" style="margin-left:px; margin-top:62px"><br> </td> </tr> </table> </td> </tr> </table> </td> <td width="41" style="height:299px" valign="top"></td> </tr> </table> </td> </tr> <tr> <td width="766" style="height:3px" valign="top"></td> </tr> <tr> <td width="766" style="height:548px" valign="top"> <table width="766" style="height:548px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="55" style="height:548px" valign="top"></td> <td width="659" style="height:548px" valign="top"> <table width="659" style="height:548px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="659" style="height:435px" valign="top"> <table width="659" style="height:435px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="181" style="height:100%" valign="top"> <table width="181" style="height:100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#E9E9E9" width="181" style="background-image: url(file:///H|/10109/10109/10109/WITHOUT_FLASH/images/m1-b.gif); background-repeat: no-repeat; background-position: bottom;height:100%" valign="top"> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/t1.gif" style="margin-left:px; margin-top:px"><br> <div class="m_text" style="margin-left:25px; margin-top:30px; margin-right:15px; margin-bottom:10px"> <strong class="ls_text">[ 12.11.2005 ]</strong><br> <br style="line-height:4px"> <a href="#" class="h_text">Vestibulum ante ipsum primis faucibu</a><br> <br style="line-height:4px"> Fusce feugiat maleda odio. Morbi nunc odio, gvida mrsus necluc tus a, lorem. Mcenas tristique orci ac sem.<br> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/line.gif" style="margin-left:px; margin-top:18px"><br> <br style="line-height:19px"> <strong class="ls_text">[ 12.11.2005 ]</strong><br> <br style="line-height:4px"> <a href="#" class="h_text">Vestibulum ante ipsum primis faucibu</a><br> <br style="line-height:4px"> Fusce feugiat maleda odio. Morbi nunc odio, gvida mrsus necluc tus a, lorem. Mcenas tristique orci ac sem.<br> <div align="left" class="_text" style="margin-left:0px; margin-top:30px"><img alt="" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/a.gif" hspace="0" vspace="0" border="0" align="left" style="margin-right:6px; margin-top:5px"><a href="#" class="l_text">more news</a></div> </div> </td> </tr> <tr> <td width="181" style="height:71px" valign="top"> <a href="#"><img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/b1.jpg" style="margin-left:px; margin-top:7px"></a><br> </td> </tr> </table> </td> <td width="7" style="height:435px" valign="top"></td> <td width="471" style="height:100%" valign="top"> <table width="471" style="background-image: url(file:///H|/10109/10109/10109/WITHOUT_FLASH/images/m2-dr.gif); background-repeat: repeat-y; background-position:;height:100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="m_text" width="471" style="background-image: url(file:///H|/10109/10109/10109/WITHOUT_FLASH/images/m2-b.gif); background-repeat: no-repeat; background-position: bottom;height:100%" valign="top"> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/t2.gif" style="margin-left:px; margin-top:px"><br> <div align="left" class="_text" style="margin-left:20px; margin-top:20px; margin-right:35px; margin-bottom:px"> <img alt="" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/p1.jpg" hspace="0" vspace="0" border="0" align="left" style="margin-right:10px; margin-top:0px"> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/spacer.gif" width="1" height="7"><br> <strong>Ultricies pharetra magna, donec acsan malada <br> Donec sit amet eros, sit amet. </strong><br> <br style="line-height:6px"> Consectetuer dipiscing elit. Mauris in fermen tum dictum.<br> magna <a href="#" class="h_text" style="text-decoration:none">(sed laoreet aliquam leo tellus)</a> dolor, dapibus.<br> eget, elementu vel, cursus eleifend, elit. Aenean auctor wisi et urna erat volutpat.<br> <div align="right" class="_text" style="margin-left:0px; margin-top:6px"><img alt="" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/a.gif" border="0" style="margin-right:6px; margin-top:0px"><a href="#" class="l_text">learn more about us</a></div> </div> <img alt="" border="0" src="file:///H|/10109/10109/10109/WITHOUT_FLASH/images/t3.gif" style="margin-left:px; margin-top:24px"><br> <div style="margin-left:25px; margin-top:22px; margin-right:px; margin-bottom:25px"> <table width="" style="height:px" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="223" style="height:px" valign="top"> <ul class="lt_text" style="margin-left:px; margin-top:px; margin-bottom:2px"> <li style="margin-top:0px"><a href="#" class="lt_text">Fusce feugiat malesada odio </a></li> <li><a href="#" class="lt_text">Morbi nunc odio, gravida at </a></li> <li><a href="#" class="lt_text">Cursus necluc tus a, lorem</a></li> <li><a href="#" class="lt_text">Maecenas tristique orci ac sem</a></li> <li><a href="#" class="lt_text">Duis ultricies pharetra.</a></li> </ul> </td> <td width="" style="height:px" valign="top"> <ul class="lt_text" style="margin-left:px; margin-top:px; margin-bottom:2px"> <li style="margin-top:0px"><a href="#" class="lt_text">Fusce feugiat malesada odio </a></li> <li><a href="#" class="lt_text">Morbi nunc odio, gravida at </a></li> <li><a href="#" class="lt_text">Cursus necluc tus a, lorem</a></li> <li><a href="#" class="lt_text">Maecenas tristique orci ac sem</a></li> <li><a href="#" class="lt_text">Duis ultricies pharetra.</a></li> </ul> </td> </tr> </table> </div> </td> Hey guys.
I am currently hosting my website on my own dedicated server, and i am trying to use the mail() function, but for some reason it doesn't send the email.
This is my php code:
the *** are real addresses.
The from is admin@host.com
<?php $to = "****"; $subject = "Test mail"; $message = "email message."; $from = "***"; $headers = "From:" . $from; mail($to,$subject,$message,$headers); echo "Mail Sent."; ?> Edited by Tzahi_ben_artzi, 02 October 2014 - 02:44 PM. Hello all, I just created this function that I want to use in CLi mode. It works perfectly in regular browser mode, but gives me this error on Cli mode if I do convertToCamelCaps('TEST STRING'); PHP Catchable fatal error: Argument 1 passed to convertToCamelCaps() must be an instance of string, string given in file... if (!function_exists('convertToCamelCaps')) { function convertToCamelCaps(string $string, $initialCaps=FALSE) { if ($words = explode(' ',$string)) { foreach ($words as $index => &$word) { $word = strtolower($word); if($index==0 && $initialCaps===FALSE) { continue; } $word = ucwords($word); } return implode('',$words); } return FALSE; } } If I remove the string datatype requirement in the function before the function argument list, it works fine in CLi mode. Please help me with this code. It keep appear in my website. "Warning: preg_match() [function.preg-match]: No ending delimiter '.' found in /home/kengsite/public_html/wp-content/plugins/statpress/statpress.php on line 1184" And this is how the line look like. if (!preg_match(".ico$", $urlRequested)) { return ''; } Hi All, I am trying to create a PHP code that will run a form, however i keep getting the error message Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in D:\xampp\htdocs\HFCC\Scripts\mailprocess.php on line 55 Invalid email address entered. Go Back and try again attached is the complete copy of the code i am using, i have an email text box and label with the id 'email' also my method is POST and my action is Scripts/mailprocess.php. Please let me know if you need any additional details. Any help will be much appreciated. Thanks if ($count==1){ header("Location:store.php"); }very simple I have issolated it and it doesn't redirect maybe u can see where my mistake is I am having trouble trying to save my image file names to mysql after reading a dir. I am trying to use the file below.
Any help would be appreciated. I was originallly getting the files to list but they we not showing up in the database.
Now the page shows up blank.
<?php require("config_0.php"); // Connect to server and select database. mysql_connect($dbhost, $dbuser, $dbpass)or die("cannot connect"); mysql_select_db("test")or die("cannot select DB"); $files = glob("images/*.jpg"); for ($i=1; $i<count($files); $i++) { $num = $files[$i]; $sql="INSERT INTO images (url) VALUES ('$num')"; if (!mysql_query($sql)) { die('Error: ' . mysql_error()); } echo '<img src="'.$num.'" alt="random image">'." "; } ?> Hello all, I'm trying to write a joomla page that will import LinkShare banners into the banner component. The problem I'm having is that LinkShare doesn't seem to always have the correct image size listed. If I use their dimensions, the images come out skewed and bad looking. So I'm trying to use getimagesize, to get the real dimensions, and it's still not working. Please take a look, and let me know if you have any suggestions. Code: [Select] <?php define('_JEXEC', 1); define('JPATH_BASE', dirname(__FILE__)); define('DS', DIRECTORY_SEPARATOR); require_once(JPATH_BASE . DS . 'includes' . DS . 'defines.php'); require_once(JPATH_BASE . DS . 'includes' . DS . 'framework.php'); $mainframe =& JFactory::getApplication('site'); $user =& JFactory::getUser(); If (($user->gid) === '25') { $token = "mylinksharetoken"; // required $status = "approved"; //application status name $mid = $_POST['mid']; $cat = $_POST['cat']; $size = $_POST['size']; //optional, use -1 as the default value. $campaignID = "-1"; //optional, use -1 as the default value $page = "1"; //optional, use 1 as a default value $startdate = ""; //formatted MMDDYYYY - optional, use an empty set as the default value (//). $enddate = ""; //formatted MMDDYYYY - optional, use an empty set as the default value (//). if (isset($_POST['submit'])) { $feed = simplexml_load_file("http://lld2.linksynergy.com/services/restLinks/getBannerLinks/{$token}/{$mid}/{$cat}/{$startdate}/{$enddate}/{$size}/{campaignID}/{$page}"); $children = $feed->children('http://endpoint.linkservice.linkshare.com/'); $entries = $children->return; foreach ($entries as $entry) { $sourcecode=GetImageFromUrl($details->imgURL); $name=md5(mt_rand()); $path = '/home/mysite/tmp/imgtmp/'; $savefile = fopen($path.$name, 'w'); fwrite($savefile, $sourcecode); list($realwidth, $realheight) = getimagesize($path.$name); $details = $entry->children('http://endpoint.linkservice.linkshare.com/'); $image = "<a href=\"{$details->clickURL}\" target=\"_NEW\">"; $image .= "<img src=\"{$details->imgURL}\" border=\"'0\" height=\"{$realheight}\" width=\"{$realwidth}\" title=\"{$details->name}\" alt=\"{$details->name}\" />"; $image .= "</a><img border=\"0\" height=\"1\" width=\"1\" src=\"{$details->showURL}\" />"; echo $image . "<br>\n"; fclose($savefile); @unlink($path.$name); } } ?> <form name="form1" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post"> Categories<select name="cat"> <option value="-1">All Categories</option> <option value="17">Business & Career</option> <option value="150">B-to-B</option> <option value="151">Employment</option> <option value="152">Real Estate</option> <option value="18">Department Store</option> <option value="153">Clothing</option> <option value="154">Gifts</option> <option value="155">Home</option> <option value="247">Jewelry</option> <option value="19">Family</option> <option value="156">Baby</option> <option value="157">Education</option> <option value="158">Entertainment</option> <option value="159">Pets</option> <option value="21">Telecommunications</option> <option value="211">Equipment</option> <option value="212">Long Distance</option> <option value="213">Wireless</option> <option value="1">Hobbies & Collectibles</option> <option value="101">Art</option> <option value="102">Auctions</option> <option value="103">Collectibles</option> <option value="2">Auto</option> <option value="104">Accessories</option> <option value="105">Cars</option> <option value="106">Rentals</option> <option value="3">Clothing & Accessories</option> <option value="207">Children</option> <option value="107">Accessories</option> <option value="108">Men</option> <option value="109">Women</option> <option value="246">Jewelry</option> <option value="4">Computer & Electronics</option> <option value="110">Hardware</option> <option value="111">Consumer</option> <option value="112">Software</option> <option value="5">Entertainment</option> <option value="113">Books/Magazines</option> <option value="114">Music</option> <option value="115">Videos</option> <option value="6">Financial Services</option> <option value="116">Banking/Trading</option> <option value="117">Credit Cards</option> <option value="118">Loans</option> <option value="7">Food & Drink</option> <option value="218">Candy</option> <option value="119">Cigars</option> <option value="120">Gourmet</option> <option value="121">Wine</option> <option value="8">Games & Toys</option> <option value="122">Children</option> <option value="123">Educational</option> <option value="124">Electronic</option> <option value="9">Gift & Flowers</option> <option value="125">Gifts</option> <option value="126">Flowers</option> <option value="127">Greeting Cards</option> <option value="10">Health & Beauty</option> <option value="229">Prescription</option> <option value="128">Bath/Body</option> <option value="129">Cosmetics</option> <option value="130">Vitamins</option> <option value="11248">Medical Supplies & Services</option> <option value="11">Home & Living</option> <option value="232">Improvement</option> <option value="131">Bed/Bath</option> <option value="132">Garden</option> <option value="133">Kitchen</option> <option value="12">Mature/Adult</option> <option value="134">Apparel</option> <option value="135">Books</option> <option value="136">Entertainment</option> <option value="13">Office</option> <option value="137">Equipment</option> <option value="138">Home Office</option> <option value="139">Supplies</option> <option value="14">Sports & Fitness</option> <option value="140">Clothing</option> <option value="141">Collectibles</option> <option value="142">Equipment</option> <option value="15">Travel</option> <option value="245">Vacations</option> <option value="143">Airline</option> <option value="144">Car</option> <option value="145">Hotel</option> <option value="16">Internet & Online</option> <option value="149">Programs</option> <option value="146">Services</option> <option value="147">Development</option> <option value="148">Hosting</option> <option value="16249">Online Dating</option> <option value="20">Miscellaneous</option> <option value="210">Other, Other Products/Services</option> </select> <?php $merchantlist = simplexml_load_file("http://lld2.linksynergy.com/services/restLinks/getMerchByAppStatus/{$token}/{$status}"); $children2 = $merchantlist->children('http://endpoint.linkservice.linkshare.com/'); $entries2 = $children2->return; echo "Manufacturers: <select name=\"mid\">\n"; echo "<option selected value=\"-1\">All Manufacturers</option>\n"; foreach ($entries2 as $entry2) { $details2 = $entry2->children('http://endpoint.linkservice.linkshare.com/'); echo "<option value=\"{$details2->mid}\">{$details2->name}</option>\n"; } echo "</select>"; ?>Size: <select name="size"> <option selected value="-1">Any Size</option> <option value="1">468x60 - Full Banner <option value="2">392x72 - Mid Banner</option> <option value="9">160x600 - Wd Skyscrp</option> <option value="10">120x600 - Skyscraper</option> <option value="11">180x150 - Rectangle</option> <option value="12">336x280 - Large Rect</option> <option value="3">234x60 - Half Banner</option> <option value="13">300x250 - Med Rect</option> <option value="14">250x250 - Sq Pop-up</option> <option value="15">240x400 - Vert Rect</option> <option value="4">125x125 - Sq Button</option> <option value="5">120x90 - Button 1</option> <option value="6">120x60 - Button 2</option> <option value="7">88x31 - Micro Bar</option> <option value="8">120x240 - Vert Banner</option> <option value="0">0x0 - Other</option> <option value="16">728x90 - Leader-board</option> <option value="17">720x300 - Pop-Under</option> <option value="18">550x480 - Pop-Up Large</option> <option value="19">300x600 - Half Page Ad</option> <option value="20">305x64 - X-Large</option> <option value="21">215x64 - Large</option> <option value="22">167x30 - Medium</option> <option value="23">112x20 - Small</option> </select> <input name="submit" type="submit" value="submit" /> </form> <?php } else { echo "not logged in"; die(); } function GetImageFromUrl($link) { $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 0); curl_setopt($ch,CURLOPT_URL,$link); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); curl_setopt($ch, CURLOPT_HEADER, 0); $result=curl_exec($ch); curl_close($ch); return $result; } ?> $Row[2] doesn't work but if I use $Row["linkcat"] than it works fine. Is there somewhere to activate in the php.ini file ? Code: [Select] // I got 9 fields to in the table tbl_link ! $Row[2] should give me a number. $Verbinding = mysql_connect($db_host, $db_user, $db_passw); mysql_select_db($db_name); $sql = "Select * from tbl_link where userid=1"; $ResultShow = mysql_query($sql); while ($Row = mysql_fetch_assoc($ResultShow)){ echo $Row[2]; } I've joined querys because I'm making my own forums. However, when it gets to the echoin out part, it shows the category and only ONE of the sub categorys. Code: [Select] <div id="forumContainer"> <?php $lastboard = ''; $forumQ = mysql_query("SELECT f1.cat_name as catName, f1.cat_id as catID, f2.cat_id as subCatID, f2.sub_id as subID, f2.sub_name as subName, f2.sub_desc as subDesc FROM `forum_cats` as f1 LEFT JOIN `forum_sub` as f2 ON f1.cat_id = f2.cat_id GROUP BY f2.cat_id "); while($forumF = mysql_fetch_assoc($forumQ)) { if($forumF['catName'] != $lastboard) { echo '<div class="forumCat">'.$forumF['catName'].'</div>'; $lastboard = $forumF['catName']; } echo '<div class="forumSub">'.$forumF['subName'].'</div>'; } ?> </div> I just started with php and made an image. But when I try to open it in my browser, it shows a broken image icon. I have put the font in the same folder as the .php file, but it doesn't work. Can somebody help me solve this problem? Here is the code: Code: [Select] <?php $font_path = "nakedchick.TTF"; $font_size = 30; $img_number = imagecreate(300,50); $backcolor = imagecolorallocate($img_number,0,162,255); $textcolor = imagecolorallocate($img_number,255,255,255); imagefill($img_number,0,0,$backcolor); $number = " So your ip is $_SERVER[REMOTE_ADDR]? "; ImageTTFText($img_number, $font_size,10,5,5,$number,$font_path,$textcolor); header("Content-type: image/png"); imagepng($img_number); ?> And also the files: (.php in attachment) http://falcogerritsjans.nl/u/signature2.php http://falcogerritsjans.nl/u/nakedchick.ttf Hi, when I output this, it's same order, I want it to be: email/message/to/toLastName please see code: $testArray=array("toLastName","to","message","email"); $reversedTestArray=rsort($testArray);//rsort returns TRUE on success //$strTestArrayReversed=implode(",",$testArray); print_r($testArray); Any idea what I am doingwrong, it looks fairly straightforward. Any help much appreciated! I have something like below Code: [Select] $j = explode("-", $ROW['options']); if(array_search("src_str", $j) == false) echo '_no'; // This doesn't work Also i tried Code: [Select] $j = explode("-", $ROW['options']); if(!in_array("src_str", $j)) echo '_no'; // This also doesn't work Is this bug or am i doing something wrong? Hello, I've been working on some stuff, and get the information parsed like this: Code: [Select] Value1,Value2,Value3 0.68,4377.54,11069.02So I'm trying to explode it and insert the latest numbers into the database. I'm using: $value = explode(",", $variable); $secondsplit = explode(" ", $value[2]); mysql_query("INSERT INTO table(row) VALUES('".mysql_real_escape_string($secondsplit[1])."')"); The problem is that it has something like an enter in the database, or a space. But I can't figure out how to get rid of that problem. Does anyone know what's wrong? Regards, NLCJ Hi guys, me again. I have been using mail to send emails ( With your great help ) successfully in about three websites. For some reason, my email doesn't want to work with the site I am busy with now. This is my code : Code: [Select] <html> <head> <title>Practice</title> </head> <body> <table border="1"> <tr> <td> <?php $emailto="hannes@ncc-cla.com"; $emailsubject="confirmation"; $emailfrom="footloose.sa@gmail.com; if(!empty($_POST['uname'])){ $yourname=$_POST['uname']; $yoursurname=$_POST['usurname']; echo "hello </td> <td>" ." " . "$yourname" . " " . "$yoursurname </td> </tr>"; $emailbody="hello </td> <td>" ." " . "$yourname" . " " . "$yoursurname </td> </tr>"; } else{ echo"<tr> <td> enter your name </td> </tr>"; $emailbody .="<tr> <td> enter your name </td> </tr>"; } if(isset($_POST['gender'])){ /*isset is what it is set to can be used */ $gender=$_POST['gender']; echo "<tr> <td> You are a </td> <td> " . " " . "$gender </td> </tr>"; $emailbody .="<tr> <td> You are a </td> <td> " . " " . "$gender </td> </tr>"; } else{ echo "<tr> <td> Select Gender </td> </tr>"; $emailbody .="<tr> <td> Select Gender </td> </tr>"; } if(isset($_POST['plang'])){ $plang=$_POST['plang']; echo "<tr> <td> You are interested in </td> <td> " . " " . "$plang </td> </tr>"; $emailbody .="<tr> <td> You are interested in </td> <td> " . " " . "$plang </td> </tr>"; } else{ echo "<tr> <td> Select Programming language </td> </tr>"; $emailbody .="<tr> <td> Select Programming language </td> </tr>"; } print "<tr> <td> Your qualification is </td> <td>"; $emailbody .= "<tr> <td> Your qualification is </td> <td>"; foreach ($_POST['qlevel'] as $level){ print "$level<BR>"; $emailbody .="$level<BR>"; } $headers='From:'. $emailfrom; mail($emailto,$emailsubject,$emailbody,$headers); ?> </td> </tr> </table> </body> </html> Hi, I am trying to get the previous id for the table xdocument, but browser outputs this warning: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given for this code: Code: [Select] <?php //HELPER FCN used by FCN: writeXMLtoDBviaDOM function mysql_next_id($table) { $result = mysql_query('SHOW TABLE STATUS LIKE "'.$table.'"'); $rows = mysql_fetch_assoc($result); return $rows['Auto_increment']; } //TEST RUN: $_filePath="C:\dir\email.xml"; $node=basename($_filePath); $dom=new DOMDocument(); $dom->load($node); $labelPath=array(); mysql_connect("localhost","root"); mysql_select_db("dummydpev"); $isXdocExist=mysql_query("SELECT (file_Path,file_Name) FROM xdocument WHERE file_Path='$_filePath' AND file_Name='$node'"); $docId=0; if(mysql_num_rows($isXdocExist)==0) { mysql_query("INSERT INTO xdocument (file_Path,file_Name) VALUES ('$_filePath','$node')"); $docId=mysql_next_id("xdocument")-1; } else $docId=mysql_next_id("xdocument")-1; writeXMLtoDBViaDOM($dom->documentElement,$labelPath,$docId,$_filePath); ?> So I think my problem is with the multiple WHERE clause conditions, can I do it like what I have above? Any help much appreciated! Another issue with trying to work on somebody else's script (and on no sleep!) I've got this mess of a page I'm trying to manipulate to add a feature to. When somebody goes to this page, it pulls all records. At the top, I added a way to refine the results by dates. That query works fine, I tested it in mysql. To avoid fighting with the original code, I created an if statement to create $query_selectAll. But when I put it in the page, it would just refresh with the same data. I echoed the query to make sure it is correct. Then I realized that there was another query, $query_selectAllItems, further down the page that was generating the results, and none of what I was doing made a difference. But I'm not sure why it's ignoring my query or how to work around this. I tried deleting the query $query_selectAllItems, thinking it would take mine, because it ends with the same: $result_all $result_all = mysql_query($query_selectall); or $result_all = mysql_query($query_selectAllItems); Code: [Select] <?php require_once('calendar/classes/tc_calendar.php'); include("include/auth.php"); include("include/conn.php"); @$a_row = mysql_fetch_array($result); // I added this if statement in to get my POST results, without having to make changes to the GET results he made. if (isset($_POST['view'])){ $view=$_POST['view']; } else { $view=$_GET['view']; } if ($view=="All") { $query_selectall = 'select * from tbl_registration'; echo $query_selectall; } elseif ($view=="dated") { $mydate = isset($_REQUEST["date5"]) ? $_REQUEST["date5"] : ""; $end_date = isset($_REQUEST["date6"]) ? $_REQUEST["date6"] : ""; $query_selectall = "SELECT * FROM tbl_registration WHERE reg_timestamped BETWEEN STR_TO_DATE('$mydate', '%Y-%m-%d') AND STR_TO_DATE('$end_date' , '%Y-%m-%d')"; echo $query_selectall; } else { $query_selectall = "select * from tbl_registration where category='$view'"; echo $query_selectall; } $result_all = mysql_query($query_selectall); @$numRows_all = mysql_num_rows($result_all); ?> <title>WYF Admin</title> <html> <head> <script language="javascript" src="calendar/calendar.js"></script> <link href="include/styles.css" rel="stylesheet" type="text/css"> <SCRIPT language="JavaScript"> <!-- function confirm_delete(idval) { var verify= confirm("Do you really want to delete this Registration?"); if (verify== true) { window.location="delete_registrations.php?action=delete&did=" + idval; } } //--> </SCRIPT> <script type="text/javascript" src="js/jquery-latest.js"></script> <script type="text/javascript" src="js/jquery.tablesorter.js"></script> <script type="text/javascript"> $(function() { $("table").tablesorter({debug: true}); }); </script> </head> <body leftmargin="0" rightmargin="0" bottommargin="0" topmargin="0" cellspacing="0" cellpadding="0" bgcolor="ffffff"> <table width="100%"><tr><td align="left"><img src="images/logo.jpg"></td></tr> <tr><td><hr></td></tr> </table> <table><tr><td valign="top"> <table cellspacing="1" cellpadding="0" bgcolor="#cccccc" border="0" width="300"> <tr><td> <table cellspacing="0" cellpadding="0" width="300" height="400" bgcolor="#ffffff" border="0"> <tr><td align="left" valign="top"> <table width="250"><tr><td valign="top"> <b>Welcome </b><br><br> <?php //$query_selectAllItems = "SELECT *, DATE_FORMAT(workshop_date, '%e-%m-%Y') as 'my_date' FROM tbl_workshops"; $query_selectAllItems = "SELECT * FROM tbl_registration"; $result_all = mysql_query($query_selectAllItems); $numRows_all = mysql_num_rows($result_all); ?> <? include "include/nav.php"; ?> </td></tr></table></center> </td></tr> <tr><td></td></tr></table></tr></td></table> </td><td valign="top"> <div style="float:left;padding-right:40px;"><a href="getcsv.php">export to csv</a></div><div> <div style="float:right;margin-right:100px;"><form name="form1" method="post" action="viewregistrations2.php"><div style="float:left;overflow:visible;padding-right:10px;">View between</div> <div style="float:left;overflow:visible;padding-right:10px;"> <?php $myCalendar = new tc_calendar("date5", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month'); $myCalendar->setSpecificDate(array("2011-06-01"), 0, ''); $myCalendar->writeScript(); ?> </div> <div style="float:left;overflow:visible;padding-right:10px;"> and </div> <div style="float:left;overflow:visible;padding-right:10px;"> <?php $myCalendar = new tc_calendar("date6", true, false); $myCalendar->setIcon("calendar/images/iconCalendar.gif"); $myCalendar->setDate(date('d'), date('m'), date('Y')); $myCalendar->setPath("calendar/"); $myCalendar->setYearInterval(2000, 2015); $myCalendar->dateAllow('2008-05-13', '2015-03-01'); $myCalendar->setDateFormat('j F Y'); $myCalendar->setAlignment('left', 'bottom'); $myCalendar->setSpecificDate(array("2011-04-01", "2011-04-04", "2011-12-25"), 0, 'year'); $myCalendar->setSpecificDate(array("2011-04-10", "2011-04-14"), 0, 'month'); $myCalendar->setSpecificDate(array("2011-06-01"), 0, ''); $myCalendar->writeScript(); ?> </div> <div style="float:left;overflow:visible;padding-right:10px;"><input type="hidden" name="view" id="view" value="dated"><input type="submit" value="go!"> </div></form> </div><br><br><br><br> <table width="95%" border="1" cellpadding="3" cellspacing="1" bordercolor="#999999" id="rowspan" class="tablesorter" name="table"><thead> <tr bgcolor="#ffffff"> <th width="125">Name</th> <th width="125">Address</th> <th width="125">Phone</th> <th width="125">Email</th> <th width="125">Workshop</th> <td width="50"> </td> <td width="50"> </td><td> </td> </tr></thead> <tbody> <? //output each row while ($c_row = mysql_fetch_array($result_all)){ ?> <tr> <td><?= $c_row['reg_fname'] ?> <?= $c_row['reg_lname'] ?></td> <td><?= $c_row['reg_address'] ?></td> <td><?= $c_row['reg_phone'] ?></td> <td><?= $c_row['reg_email'] ?></td> <td> <?php $catid = $c_row['reg_workshopid']; $query="SELECT * FROM tbl_workshops where workshop_id = '$catid'"; //Run query; $result=@mysql_query($query); $row=mysql_fetch_array($result); ?> <?php echo($row['workshop_title']); ?> </td> <td width="50" bgcolor="#DEE1EB"><div align="center"><a href="edit_registration.php?id=<? print $c_row['reg_id'] ?>">edit</a></div></td> <td width="50" bgcolor="#DEE1EB"><div align="center"><a href="javascript://" onClick="confirm_delete(<? print $c_row['reg_id'] ?>); return false">delete</a></div></td> <td width="50" bgcolor="#DEE1EB"><div align="center"><a href="printregistration.php?regid=<? print $c_row['reg_id'] ?>">view all / print</a></div></td> </tr> <? } //end while ?> </tbody> </table><br><br> </td></tr></table> |