PHP - Problem Requesting Id
Hi:
I am trying to request an id to do a transfer back to a page, but am having difficulties. This is on a page where a person can add a new section, which gets assigned a unique id. I am trying to send the user to the page where they can edit the new page, once it has been created. Like this: a_websiteDataADD.php Code: [Select] <?php $id = $_REQUEST['id']; ?> ... <script language="JavaScript"> alert("The new section was added!"); location.href = "a_websiteData.php?id=[id]"; </script> What am I missing on this ?? Similar TutorialsHi
What is the best recommended way to "sort through" and "place certain data" into a sql table?
For example, I create a input form.php
Company Name:
The Blah CompanyProduct/Industry Dedicated ServersHTML Source Code <div class="allservers"> <div class="serverType" id="server1"> <div class="myFeaturesBox"> <ul class="tabination"> <li><a href="#" class="activeTab" data-tab='feature'>FEATURED</a></li> <li><a href="#" data-tab='single'>SINGLE PROCESSOR</a></li> <li><a href="#" data-tab='dual'>DUAL PROCESSOR</a></li> <div class="clear"></div> </ul> <div class="feature myTab activeTabs"> <table class="table"> <tr> <th></th> <th>Processor</th> <th>RAM</th> <th>Hard Drive</th> <th>Price/Mo</th> <th></th> <th></th> </tr> <tr> <td><img src='img/server.png' alt='Server' width="20" height="20" /></td> <td>Intel Xeon E3-1230 (4x3.2GHz)</td> <td>8 GB DDR3</td> <td>1x500 GB SATA</td> <td>$98.00</td> <td><a href="https://portal.securedservers.com/wap-jpost3/UP011013E31230" target="_self"><img src='img/deploy.png' alt='Deploy Now' width="86" height="18" /></a></td> <td class="wB"></td> </tr> <tr> <td><img src='img/server.png' alt='Server' width="20" height="20" /></td> <td><div style="position:relative;">Intel Xeon E3-1240 v3 (4x3.4GHz)</div></td> <td>8GB DDR3</td> <td>1x1 TB SATA</td> <td>$128.00</td> <td><a href="https://portal.securedservers.com/wap-jpost3/UP031013E31240" target="_self"><img src='img/deploy.png' alt='Deploy Now' width="86" height="18" /></a></td> <td class="wB"></td> </tr> <tr> <td><img src='img/server.png' alt='Server' width="20" height="20" /></td> <td><div style="position:relative;">Intel Xeon E3-1240 v3 4-bay (4x3.4GHz)</div></td> <td>8GB DDR3</td> <td>4x500 GB SATA</td> <td>$148.00</td> <td><a href="https://portal.securedservers.com/wap-jpost3/UP431013E31240" target="_self"><img src='img/deploy.png' alt='Deploy Now' width="86" height="18" /></a></td> <td class="wB"></td> </tr> <tr> </table>Submit Button --> sends to the "sorting process?" than into proper DB tables for search query. Ultimately, there I require to be able to pull from my DB upon query, pricing, hardware, processor, etc.. Any recommendation for me to try? I'm new to PHP but I want to learn and do it myself (better after effect feeling than paying someone) Hi there,
I have a question, which I seem to be unable to find out myself;
I have my own webshop (coded by myself), and trying to add multiple configurable options into it, each option having their own stock limit.
Here is the problem:
I am trying to implement AJAX for the following:
Lets say: Customer wants Product A with Config 1: A, Config 2: C and Config 3: C
Lets say config 1 is length, Config 2 is design of the product, and config 3 is the dimension of the product.
Config 1 Option A has 12 items in stock
Config 2 Option C has 7 items in stock
Config 3 Option C has 1 item in stock.
Here is my question:
How do I implement AJAX to check all these variables (so lets say: You have Config A with Option A (12 stock) B (16 stock) and C(109 stock), etc, and when she selects for example Config 3 Option C, that she can ONLY order 1 of the items, and if she tries to put the order in higher (in the selector) that it sais that with the current configuration only 1 order can be made?
This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=351526.0 Hi all. I have been trying something for 2 days, having no success and was hoping someone could help. I know this is a long post but it's mostly just php code below. I'm trying to do "pagination" for a script that I came across. First of all.. I am not a programmer in any way. I didn't even know what pagination was until 2 days ago when I was trying to explain what I wanted in a forum and was educated. So.. off to Google I went. I found all kinds of "free pagination" script articles with "how-to's". Well.. I think you need to at least have an idea of how to program becuase I've tried 4 now and failed every time. Or... maybe I'm just the world's worst at understanding programming concepts (very possible). I really have spent just hours and hours trying to make pagination happen.. to no avail. So.. if you know an easier way, please share! Or.. If you care to read on and help with the pagination script I've been trying to make work, that would be awesome. Either way, I would be most grateful! Here's what I got and what I've tried.. My index.php page: Code: [Select] <?php include_once('inc_dbcon.php'); require_once('admin/config.php'); require_once($languageFile); // Preview descrition length in characters $previewLength = 240; // check to see if in admin mode and validate key global $keyOut; $keyOut = ""; if (isset($_GET["k"])) if($_GET["k"] == $key){ // Key comes from admin/password.php file $keyOut = "&k=" . $key; } global $category; $category = "%"; if (isset($_GET["category"])) $category = mysql_real_escape_string($_GET["category"]); $msg = ""; if (isset($_GET["msg"])) $msg = mysql_real_escape_string($_GET["msg"]); // SEARCH CODE START $searchQuery = ""; if (isset($_GET["q"])) $searchQuery = mysql_real_escape_string($_GET["q"]); if ($searchQuery != "") { $query_Recordset1 = "SELECT postId,category,title,description,isAvailable,description,price,confirmPassword,category,imgURL,imgURLThumb,DATE_FORMAT(timeStamp,'%b %d, %Y %l:%i %p') AS timeStamp1 FROM md_postings WHERE isConfirmed = '1' AND title like '%$searchQuery%' OR description like '%searchQuery%' ORDER BY `timeStamp` DESC"; } else { $query_Recordset1 = "SELECT postId,category,title,description,isAvailable,description,price,confirmPassword,category,imgURL,imgURLThumb,DATE_FORMAT(timeStamp,'%b %d, %Y %l:%i %p') AS timeStamp1 FROM md_postings WHERE isConfirmed = '1' AND category like '$category' ORDER BY `timeStamp` DESC"; } // SEARCH CODE END - see also line 113 below $maxRows_Recordset1 = 100; $pageNum_Recordset1 = 0; if (isset($_GET['pageNum_Recordset1'])) { $pageNum_Recordset1 = mysql_real_escape_string($_GET['pageNum_Recordset1']); } $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1); $Recordset1 = mysql_query($query_limit_Recordset1); if (!$Recordset1){ print("It appears we have a problem: " . mysql_error()); exit(); } $row_Recordset1 = mysql_fetch_assoc($Recordset1); if (isset($_GET['totalRows_Recordset1'])) { $totalRows_Recordset1 = mysql_real_escape_string($_GET['totalRows_Recordset1']); } else { $all_Recordset1 = mysql_query($query_Recordset1); $totalRows_Recordset1 = mysql_num_rows($all_Recordset1); } $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; $queryString_Recordset1 = ""; if (!empty($_SERVER['QUERY_STRING'])) { $params = explode("&", $_SERVER['QUERY_STRING']); $newParams = array(); foreach ($params as $param) { if (stristr($param, "pageNum_Recordset1") == false && stristr($param, "totalRows_Recordset1") == false) { array_push($newParams, $param); } } if (count($newParams) != 0) { $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams)); } } $queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1); ?> <!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" xml:lang="en"> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link href="md_style.css" rel="stylesheet" type="text/css" /> <script language="JavaScript"> function doFilter(dis) { window.location.href = "index.php?category=<?php echo $category ?>&type=" + dis.value + "<?php echo $keyOut;?>" } </script> </head> <body> <?php include_once("inc_navigation.php") ;?> <div id="md_container"> <?php if ($msg == "deleted") print("<br clear='all' /> <div class='md_msg' style='margin-top:-10px;'>" . STR_DELETED ."</div>"); ?> <br clear="all" /> <div id='md_listingBox'> <?php if($totalRows_Recordset1 < 1) { // SEARCH START new Code - added IF statement to support search if ($searchQuery != "") echo "<p><br /><br /><br />" . STR_NORESULTS . "<b>" . $searchQuery ."</b></p>"; else echo "<p><br /><br /><br />" . STR_NOITEMS . "</p>"; // SEARCH END NEW CODE } else { do { $img = "/images/gift_light.gif' title='This is a gift!'"; $type = $row_Recordset1['type']; $isAvailable = $row_Recordset1['isAvailable']; $isAvailableClass = ($isAvailable == 0) ? 'md_taken' : ''; $thumbnail = ' '; if (strlen($row_Recordset1['imgURLThumb']) > 3){ $thumbnail = "<a href='viewItem.php?id=" . $row_Recordset1['postId'] . "' class='md_recordLink " . $isAvailableClass . "'>"; $thumbnail .= "<img src='" . $row_Recordset1['imgURLThumb'] . "' class='md_thumbnail' border='0'></a>"; } ?> <table width="100%" border="0" cellpadding="4" class="md_listingTable"> <tr> <td width="54" align="center"><?php echo $thumbnail; ?></td> <td valign="top"> <div class='md_date'><?php echo $row_Recordset1['timeStamp1'];?></div> <a href="viewItem.php?id=<?php echo $row_Recordset1['postId'] . $keyOut;?>" class='md_recordLink<?php echo $isAvailableClass; ?>'><?php echo stripslashes($row_Recordset1['title']); ?></a> — $<?php echo $row_Recordset1['price']; ?> <br /> <?php echo stripslashes(substr($row_Recordset1['description'],0,$previewLength)); ?>... </td> </tr> </table> <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); } // end else clause ?> </div> </div> <?php include_once("inc_footer.php");?> </body> </html> <?php mysql_close($dbConn); ?> Here's the inc_dbcon.php file that it calls to connect: Code: [Select] <?php // Change these to be for your database $dbhostname = "localhost"; $dbname = "justtes1_123"; $dbusername = "justtes1_12"; $dbpassword = "abc12"; if(!$dbConn = mysql_connect($dbhostname, $dbusername, $dbpassword)) die('I could not connect to the database. Clease check the inc_dbcon file and make sure everything is correct.'); if(!mysql_select_db($dbname, $dbConn)) die('I could not select the database. Check the inc_dbcon file and make sure everything is correct.'); ?> I've trying to use the pagination script from: http://www.phpeasycode.com/pagination/ Here's the "usage example" that is in the pagination script: Code: [Select] <?php $rpp = 10; // results per page $adjacents = 4; $page = intval($_GET["page"]); if($page<=0) $page = 1; $reload = $_SERVER['PHP_SELF']; // connect to your DB: $link_id = mysql_connect($dbhost, $dbuser, $dbpass) or die(mysql_error()); mysql_select_db($dbname, $link_id); // select appropriate results from DB: $sql = "SELECT * FROM table_name WHERE table_field LIKE '%search string%' ORDER BY field_name"; $result = mysql_query($sql, $link_id); // count total number of appropriate listings: $tcount = mysql_num_rows($result); // count number of pages: $tpages = ($tcount) ? ceil($tcount/$rpp) : 1; // total pages, last page number $count = 0; $i = ($page-1)*$rpp; while(($count<$rpp) && ($i<$tcount)) { mysql_data_seek($result,$i); $query = mysql_fetch_array($result); // output each row: echo "<p>" . $query['table_field_1'] . ", " . $query['table_field_2'] . "</p>\n"; $i++; $count++; } // call pagination function: include("paginate.php"); echo paginate_three($reload, $page, $tpages, $adjacents); ?> The pagination script also comes with a demo.php. I uploaded that and it works just great. But.. when I try to incorporate the above usage into my index.php, I fail miserably. So.. If you prefer, I can copy index.php with what I've tried.. which is apparently very wrong. The page I tried it in is he http://justtesting.freehosting.com/indexPaginate.php So.. if anyone is able to tell me how they'd incorporate the usage script into the index.php, that would solve my 2 day dilemna and I would be eternally grateful. If you want to login to my test version (feel free to edit as this is purely a test site), it's he http://justtesting.freehosting.com/ ftp host: 62.75.203.94 FTP Username: justtes1 FTP Password: JpxF34j80h A HUGE thanks for anyone who can help! I have tried everything for hours and hours.. Ok so I am writing a CMS to wrap around a company script I wrote a while back. I am having trouble requesting dynamic form names. Heres the code to generate the input fields: $fields = mysql_result($result,$i,"fields"); $exFields = explode(",", $fields); for($i = 0; $i < count($exFields); $i++){ echo "$exFields[$i] : <input type=\"text\" name=\"$exFields[$i]\"> <br>"; } Ok so it generates the fields the way I want. (design crap will be done later) But I am having issues on processing the form, for example: Fields get generated -> Client Fills them in -> Submitted into our already built function. The function takes those form values and creates an XDF file with the correct requested values. But like I said I am having issues requesting the form values because they wont be static they will differ depending on each PDF. Can anyone point me in the direction on how to get the form values? I'm developing a javascript widget to display on other people's websites that will have a php file(on my hosting account) as its source. Is there a way for php to get the domain of the site that is requesting the php file? I want the user to be able to specify if they want the widget to only display on their website. So i would store the user's domain name in my db and then write in the php script to check to see if the website requesting the widget matches whats in my db...if so display widget...if not..don't. Hello guys,
I require a suggestion about how shall I proceed as when I am about to set a goal for my future in programming world, Just so that you could suggest me better, I urge you to please read about a little background history of mine. And please stay neutral in regards of language, dont say PHP because you are a PHP developer and dont say Java because you are a Java developer.
Thanks.
I stepped into programming when I was in school (below A-levels at 14, now I am 29) and I started to bunk school and went to internet cafe and would sit there reading sources of HTML pages in year 2000. I would observe their programming styles, I would learn about the tags they used and then search internet (it was IE6 then and Yahoo searching at its peak) so I could learn about it.
Years passed, and having my family related to medical professions, I took admission in Pharmacy in University and quit after 2 years and entered working class. My development slowed down but passion always stayed the same.
Now I am in Spain and working as a technician of mobile repairing with a company, but I still have this passion of programming and when I learn that etc etc friend of mine now is working with CISCO in Germany, now is working as a game developer in America, I become really sad. I could have been one of those. But the fact is that I am not. So I restarted again with development and started learning PHP on my work desk using online resources and tutorials and asking silly questions.
Nothing I could become but an obsolete language programmer with a mess.
Now when I havent been able to become someone, till now, I still have passion and I want to be somewhere.
-----------------------------
I am confused for some days now, shall I continue with PHP (apart from the fact that i am a MYSQL learner, haven't learned PDO or MYSQLi till now) or shall I step into Java learning, using the online resources ofCourse, but if I step into Java, It will be a fresh start and I will be able to organize it better on my way with guidance of professionals like you.
The Things confusing me: (as I am imagining in my mind)
PHP:
A great web development language being used on billions of website, have an extraodinary support, well documented, World is moving online, so future is e-commerce in these terms.
JAVA:
Feels a giant to me, and impresses me at times, a myth to me, I am speaking illogical I know, and after android, I see a great potential in this language.
Edited by Digitizer, 28 August 2014 - 06:03 PM. Hey everyone, I'm new to this forum and I came here looking for some help with PHP. I've just started getting into PHP and you guys are probably a smile ahead. So basically, I have some inputs and want them to be sent to my email in a basic layout shown below. Code: [Select] Inputs: Title = _title Forum Name = _forumname Name = _irlname Age = _age I want the email to be sent to me like: Code: [Select] Email Title --------------- Forum Name: TextGiven Real Life Name: TextGiven Age: TextGiven Here is my current code which titles the email correctly, but I want to figure out how to make $message set to the example email I showed above. Code: [Select] <?php $to = "******@*********.net"; $subject = $_REQUEST['_title']; $headers = "From: ***** Applicant \r\n"; $headers .= "MIME-Version: 1.0\r\n" . "Content-Type: text/html; charset=\"iso-8859-1\"\r\n" . "Content-Transfer-Encoding: 7bit\r\n"; $message = $_REQUEST['_forumname' & '_irlname']; <--- Part I want fixed if(mail($to, $subject, $message, $headers)) { echo 'MAIL SENT'; } else { echo 'MAIL FAILED'; } ?> I have this code, and it works. But I want $message = "" to make the message contain not just the forum name, but as well as the name, age, and all other inputs I want. Hi Everyone, This is Tamilmani Mohan , i have few doubts in SQL Stored Procedure. I am able to run the SQL SP using odbc driver and also get the result set. For Example: odbc_exec($connection,"exec get_Members"); I don't know how to run the input / output parameters SP's? Example:- If i run the below code by using SQL Management Visual Studio, I am able to insert to new record and get the member id and error code values. declare @MemberId int,@Error int EXEC INSERT_MEMBER 1,'Tamilmani','Mohan','Address1', 'Address2', 'Address3','Salem','Tamilnadu','India',9993234234 , @MemberId OUTPUT , @Error OUTPUT SELECT @MemberId , @Error I don't know how to run this type code in PHP ODBC ? Kindly , please any one give me good suggestion for this problem ? Thanks Tamilmani Mohan Guys thanks for helping me solve the problem i had but now i have another problem and i am lost. i have included the code below for you to have overview.
This is the code:
<table style="width:100%; margin-left:auto; margin-right:auto"> Hi, im creating a script for a website that will list products, i have the basic construct which lists the products from the database but it lists then vertically, i have set the width of each 'product' to 200px so i could have around 3 colums and many rows. can anybody advise how i would make them run vertically aswell as horizontally? my code below: <?php include_once("include/globals.php"); ?> <!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" /> <title>Untitled Document</title> <link href="styles/stylesheet.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="main"> <?php //Get database Results $result = mysql_query("SELECT * FROM Products WHERE is_active = 1") or die(mysql_error()); //keeps getting the next row until no more records while($row = mysql_fetch_array($result)) { //echo results ($result) echo '<div id="holder">'; echo '<div class="title">' . $row['Name'] . '</div>'; //insert image here echo '<div class="image">'; echo '<img src="' . $row['image'] . '" width="100" alt="">'; echo '</div>'; echo '<div class="tag_line">'; echo $row['Tag_Line']; echo '</div>'; echo '<div class="price">Now Only: £'; echo $row['Website_Price']; echo '</div>'; echo '<div class="prod-footer"></div>'; echo '</div>'; } ?> </div> </body> </html> table structu Field Type Null Default Comments MIME ID int(11) No product_code varchar(255) No Name varchar(255) Yes NULL Tag_Line varchar(255) Yes NULL Description varchar(255) Yes NULL Specification varchar(255) Yes NULL Technical_Info varchar(255) Yes NULL Cost_Price_USD decimal(10,2) Yes NULL Cost_Price_GBP decimal(10,2) Yes NULL Built_in_delivery decimal(10,2) Yes NULL Trade_Price decimal(10,2) Yes NULL Trade_Plus_Price decimal(10,2) Yes NULL Website_Price decimal(10,2) Yes NULL Is_active int(1) No image varchar(255) Yes NULL i'm getting this erro "Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 in /***/***/*****.php on line 278 not an active session, starts new" this is the code: if ($phase = mysql_result(mysql_query("SELECT `phase` FROM `as_support` WHERE `mission` = '$var2'"),0,0)) { if ($phase=='5') { // mysql_query("DELETE FROM `as_support` WHERE `mission` = '$var2'"); // header("Location: https://www.**********/*******/*******.php"); } else { echo date('h:i:s') . ": PHASE is $phase<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; } } else { echo "not an active session, starts new<br />"; echo "\$var1=$var1,\$var2=$var2<br />"; mysql_query("INSERT INTO `as_support` (`mission`, `phase`) VALUES ('$var2', '0')") OR DIE(mysql_error()); the first line is line no. 278 can someone please tell me what to do? tnx shirley I am trying to use the following code snippet to return values from a database with a "," after each value apart form the last one. At the moment for testing I have 2 rows with values 1 and 3 $totalRows_Recordset3 equals 2 (I echoed this to check) $i=1; while($row_Recordset3 = mysql_fetch_assoc($Recordset3)) { if($i < $totalRows_Recordset3) { $str = $str.$row_Recordset3['reading'].","; $i=$i+1; } else { $str = $str.$row_Recordset3['reading']; $i=$i+1; } } I get the number 3 which is the last value in the database, but I can't see why I don't get "1,3" I am sure it is something simple but it just escapes me. Thanks in advance for any help Gordon I have a simple text file called bio.txt: Code: [Select] wohlersr; Richie Wohlers; Intermediate; Four Aces meyersg; Greg Meyers; Novice; Four Aces I wrote a little script, to return the info for Greg Meyers if the user id is correct, or say "Member not found" if incorrect. For some reason, my output is giving me both. I assume it's a context error, but can't figure it out. Here's my script: Code: [Select] <?php $file=file("bio.txt"); $count=count($file); $i=0; while($i<=$count) { $row = explode(";", $file[$i]); $id = $row[0]; $name = $row[1]; $class = $row[2]; $club = $row[3]; if($id=="meyersg"){ echo $name."</br>"; echo $class."</br>"; echo $club."</br>"; }else{ echo "Member not found."; } $i++; } ?> And here's the output I'm getting: Code: [Select] Member not found. Greg Meyers Novice Four Aces Member not found. Okay, so i'm using the basic php mysql insert into function but I have a strange (or maybe not so strange, I just don't get it..) problem.. I have two columns (do you call them columns? I don't really know for sure, whatever things that are in a table whatsoever). Name and Trailer. EDIT: they are TEXT's if that matters Name is really nothing important, just the name. But I want to embed trailers.. If I embed the Megavideo code below: Code: [Select] <object width="400" height="300"><param name="movie" value="http://www.megavideo.com/v/8UZFURZQ2b55ada04d73ae65c726a5383b9ee9d9"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.megavideo.com/v/8UZFURZQ2b55ada04d73ae65c726a5383b9ee9d9" type="application/x-shockwave-flash" allowfullscreen="true" width="400" height="300"></embed></object> Everything works fine, no problems and no bullshit. But.. if I for an example try to embed this one (NovaMov): Code: [Select] <iframe style='overflow: hidden; border: 0; width: 400px; height: 300px' src='http://embed.novamov.com/embed.php?width=400&height=300&v=xngq7u8yejwbt' scrolling='no'></iframe> It doesn't work. It just doesn't insert. Is inserting an "iframe" a problem or something? I just don't get why the hell it would do this? Does anyone know anything about this? If so i'd be eager and very thankful to hear why and how to fix it. thanks in advance Hi there, I have a map of America made in flash, where you click on a state and the page should display the SQL database information for that state in the HTML table - but instead all it shows is the first entry of the database regardless of which state you click and it doesn't display the 2 radio buttons. My code is as follows Flash Actionscript 3 (just showing one state) Code: [Select] function waClick(event:MouseEvent):void { var waURL:URLRequest = new URLRequest("restaurants.php?state=Washington"); navigateToURL(waURL, "_self"); } wa_btn.addEventListener(MouseEvent.CLICK, waClick); PHP code Code: [Select] <?php include("mvfconnect.php"); $theChoice = $_GET['state']; $query = "SELECT * FROM restaurants WHERE" .$theChoice; $result = @ mysql_query($query); if (!$result) { $message="Unfortunately we are having problems with this page, we promise to have it fixed as soon as possible"; die($message); } $num = mysql_num_fields($result); $i=0; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $show1=substr($row['state'],0,50)."..."; $show2=substr($row['city'],0,50)."..."; $show3=substr($row['rname'],0,50)."..."; $show4=substr($row['address'],0,50)."..."; $show5=substr($row['pnum'],0,50)."..."; $show6=substr($row['web'],0,50)."..."; $show7=substr($row['dishes'],0,50)."..."; $show8=substr($row['dish_details'],0,50)."..."; $show9=substr($row['challenges'],0,50)."..."; $show10=substr($row['challenge_details'],0,50)."..."; $show11=substr($row['youtube'],0,50)."..."; $show12=substr($row['images'],0,50)."..."; echo "<tr>". "<td>".$row['city']."</td>". "<td>".$row['rname']."</td>". "<td>".$row['address']."</td>". "<td>".$row['pnum']."</td>". "<td>".$row['web']."</td>". "<td>".$row['dishes']."</td>". "<td>".$row['challenges']."</td>". "<td id='state".$i."' style='display:none'>".$row['state']."</td>". "<td id='city".$i."' style='display:none'>".$row['city']."</td>". "<td id='rname".$i."' style='display:none'>".$row['rname']."</td>". "<td id='address".$i."' style='display:none'>".$row['address']."</td>". "<td id='pnum".$i."' style='display:none'>".$row['pnum']."</td>". "<td id='web".$i."' style='display:none'>".$row['web']."</td>". "<td id='dishes".$i."' style='display:none'>".$row['dishes']."</td>". "<td id='dish_details".$i."' style='display:none'>".$row['dish_details']."</td>". "<td id='challenges".$i."' style='display:none'>".$row['challenges']."</td>". "<td id='challenge_details".$i."' style='display:none'>".$row['challenge_details']."</td>". "<td id='youtube".$i."' style='display:none'>".$row['youtube']."</td>". "<td id='images".$i."' style='display:none'>".$row['images']."</td>". "<td><input type='radio' name='vid' id='vid".$i."' onclick='openVideo(".$i.")' /></td>". "<td><input type='radio' name='pic' id='pic".$i."' onclick='openImage(".$i.")' /></td>". "<td class='last'style='display:none'>".$show1." ".$show2." ".$show3." ".$show4." ".$show5." ".$show6." ".$show7." ".$show8." ".$show9." ".$show10."</td>". "</tr>"; $i++; } ?> I have used this code before and it has worked fine, can someone please help me out! Hi, i use mysql_real_escape_string() function when insert in db, but when echo i use htmlentities($var, ENT_QUOTES, "UTF-8") Now problem is '\ in that text. In db it write text with single quote with \, example That\'s wrong, and when echo it show just the same like in db.. How can i fix this ? Hi. I am from poland. I am 17 old age and like webmastering. I write my social network. I have new server 10 GB VPS and my script no runing In my server. in my server do can not login. No runing function Code: [Select] mb_strtolower();as delete function mb_strtolower() ; this login runing. In my server haven`t installing liberary GD and no runing upload avatars. my code upload is: elseif ($_GET['act'] == "upload") { echo <<< KONIEC <hr> <center> <p> <h2>Dodaj zdjęcie</h2> <ul class="gallery clearfix"> <li class="extra"> KONIEC; error_reporting(E_ALL); // we first include the upload class, as we will need it here to deal with the uploaded file include('include/class.upload.php'); // retrieve eventual CLI parameters $cli = (isset($argc) && $argc > 1); if ($cli) { if (isset($argv[1])) $_GET['file'] = $argv[1]; if (isset($argv[2])) $_GET['dir'] = $argv[2]; if (isset($argv[3])) $_GET['pics'] = $argv[3]; } // set variables $dir_dest = (isset($_GET['dir']) ? $_GET['dir'] : 'test'); $dir_pics = (isset($_GET['pics']) ? $_GET['pics'] : $dir_dest); if (!$cli) { } // we have three forms on the test page, so we redirect accordingly if ((isset($_POST['action']) ? $_POST['action'] : (isset($_GET['action']) ? $_GET['action'] : '')) == 'simple') { // ---------- SIMPLE UPLOAD ---------- // we create an instance of the class, giving as argument the PHP object // corresponding to the file field from the form // All the uploads are accessible from the PHP object $_FILES $handle = new Upload($_FILES['my_field']); // then we check if the file has been uploaded properly // in its *temporary* location in the server (often, it is /tmp) if ($handle->uploaded) { // yes, the file is on the server // now, we start the upload 'process'. That is, to copy the uploaded file // from its temporary location to the wanted location // It could be something like $handle->Process('/home/www/my_uploads/'); $handle->Process($dir_dest); function TestProcess(&$handle, $title = 'test', $details='') { global $dir_pics, $dir_dest; $unlink = 'test/'. $handle->file_dst_name; $myid = $_SESSION['id']; $opis = htmlspecialchars(stripslashes(strip_tags(trim($_POST["opis"]))), ENT_QUOTES); $handle->Process($dir_dest); if ($handle->processed) { unlink("$unlink"); $link = ''.$dir_pics.'/' . $handle->file_dst_name .''; $addphoto = mysql_query("INSERT INTO photo VALUES('', '$myid', '$link', '$opis')"); echo <<< KONIEC <br> <center> <img src="$link" > <br> <br /> </center> KONIEC; } else { echo '<fieldset class="classuploadphp">'; echo ' <legend>' . $title . '</legend>'; echo ' Error: ' . $handle->error . ''; if ($details) echo ' <pre class="code php">' . htmlentities($details) . '</pre>'; echo '</fieldset>'; } } if (!file_exists($dir_dest)) mkdir($dir_dest); // ----------- $handle->image_convert = 'jpg'; $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 500; $handle->image_precrop = 15; $handle->image_watermark = "watermark_large.png"; $handle->image_watermark_x = 20; $handle->image_watermark_y = -20; TestProcess($handle, '15px pre-cropping (before resizing 800 wide), large watermark automatically reduced, position 20 -20', "\$foo->image_convert = 'jpg';\n\$foo->image_resize = true;\n\$foo->image_ratio_y = true;\n\$foo->image_x = 800;\n\$foo->image_precrop = 15;\n\$foo->image_watermark = 'watermark_large.png';\n\$foo->image_watermark_x = 20;\n\$foo->image_watermark_y = -20;"); } else { // one error occured echo '<fieldset>'; echo ' <legend>file not uploaded to the wanted location</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } // we copy the file a second time // we delete the temporary files $handle-> Clean(); } else { // if we are here, the local file failed for some reasons echo '<fieldset>'; echo ' <legend>local file error</legend>'; echo ' Error: ' . $handle->error . ''; echo '</fieldset>'; } echo <<< KONIEC <li> </ul> </p> </center> KONIEC; is it the only problem that isn`t installing GD as i have something off in php.ini ? Plise Help me I do not receive email for my published php file which is: <?php ///// easend.php ///// $youremail = "acdelco40108@yahoo.com"; /*put the email address here, between quotes, the email address you want the message sent to*/ $to = $youremail; $email = $_POST['EMail']; $name2 = $_POST['Name']; $street2 = $_POST['Street']; $city2 = $_POST['City']; $state2 = $_POST['State']; $zip2 = $_POST['Zip']; $Phone = $_POST['Home_Phone']; $Cell = $_POST['Cell_Phone']; $education = $_POST['email1']; $comments = $_POST['email2'] ; $headers = "From:" . $email; $fields = array(); $fields{"Name"} = "Name"; $fields{"Street"} = "Street"; $fields{"City"} = "City"; $fields{"State"} = "State"; $fields{"Zip"} = "Zip"; $fields{"Home_Phone"} = "Home Phone"; $fields{"Cell_Phone"} = "Cell Phone"; $fields{"EMail"} = "Email"; $fields{"email1"} = "Education"; $fields{"email2"} = "Comments"; $subject = "We have received the following information from your employment application"; $body = "We have received the following information from your employment application:\n\n"; foreach($fields as $a => $b) { $body .= sprintf("%20s: %s\n",$b,$_POST[$a]); } mail ($to, $subject, $body, $headers); //send mail to owner #end create email vars $headers = "From:" . $to; mail ($email, $subject, $body, $headers); //send mail to user #end create email vars echo "<head><META HTTP-EQUIV=\"Refresh\" CONTENT=\"2; URL=ThankYou.html\"></head>"; ?> im making a website it works fine on firefox but on ie doesnt work correctly. page looks weird i see the error is <? include("index/index_files/front/php/include.php"); ?> anyone can help me its in a <html> tab. |