-
Posts
837 -
Joined
-
Last visited
Everything posted by samshel
-
print the query and post here please.
-
Use the if else condition to check if the value os 0 or 1 and depending on that put the keyword "checked" <input type="checkbox" name=mybox value="1" checked> - This will show the checkbox as checked.
-
I agree. Sorry thought it was other way round.
-
preg_match('/name="hash" value="([a-zA-Z0-9\%]+)"/', $hash, $arrMatches); echo $arrMatches[1];
-
<html> <?php session_start(); include '../Database/connection.php'; $Value22 = mysql_real_escape_string(trim($_POST['myselects'])); $_SESSION['myselect23'] = $Value22; //echo $_SESSION['myselect23']; ?> <body> <form action="Staff_Menu.php" method="post"> <?php include '../Database/previous_q.php'; $intNumber = 1; while($info = mysql_fetch_array( $sql )) { echo "[$intNumber] {$info['Que_Question']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice1[]\" value=\"{$info['Que_Choice1']}\" /> "; echo "{$info['Que_Choice1']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice2[]\" value=\"{$info['Que_Choice2']}\" /> "; echo "{$info['Que_Choice2']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice3[]\" value=\"{$info['Que_Choice3']}\" /> "; echo "{$info['Que_Choice3']} <br />\n"; echo "<input type=\"checkbox\" name=\"choice4[]\" value=\"{$info['Que_Choice4']}\" /> "; echo "{$info['Que_Choice4']} <br />\n"; $intNumber++; } ?> <input type="submit" value="submit"/> </body> </html> </body> </html>
-
Try This: <? session_start(); ?> <link href="/styles/main.css" rel="stylesheet" type="text/css" /> <? //get data $button = $_GET['submit']; $search = $_GET['search']; $search = strtoupper($search); $s = $_GET['s']; if (!$s) $s = 0; $e = 10; // Just change to how many results you want per page $next = $s + $e; $prev = $s - $e; if (strlen($search)<=2) echo "Must be greater then 3 chars $user"; else { $header = ("<table width='100%' border='0' height='80' cellpadding='4' bgcolor='#000000' > <tr> <td width='39%' height='76' valign='top'><p><span class='stigrosheadfont'><strong>www.StigRos.com</strong></span><strong><span class='headnocrap'><br /> ( No Crap - Just Quality Movie & Music Downloads )</span></span><br /> <a href='http://mysite' class='headerlinkcolor'>Home</a> | <a href='register.php' class='headerlinkcolor'>Register</a> | <a href='#' class='headerlinkcolor'>Contact us</a></strong></td> <td width='47%' valign='bottom'><p class='normalblacktext'>You are currently logged in, <b>$_SESSION[username]</b></td> <td width='14%' valign='top'><div align='center'> <div align='center'><span class='headfont'><strong>Disclaimer</strong></span></div> <div align='center'>"); echo $header; include_once 'countertest.php'; echo date('F d, Y')."</div></td> </tr> </table>"; echo " <form action='search.php' method='GET'> <center> <br> <input name='search' type='text' class='blacktext' size='50'> <input name='submit' type='submit' class='blacktext' value='Search Film'></font></p> </center> </form> "; //connect to db include('db.php'); //explode out search term $search_exploded = explode(" ",$search); foreach($search_exploded as $search_each) { //construct query $x++; if ($x==1) $construct .= "keyword LIKE '%$search_each%'"; else $construct .= " OR keyword LIKE '%$search_each%'"; } //echo outconstruct $constructx = "SELECT * FROM movies WHERE $construct"; $construct = "SELECT * FROM movies WHERE $construct LIMIT $s,$e"; $run = mysql_query($constructx); $foundnum = mysql_num_rows($run); $run_two = mysql_query("$construct"); if ($foundnum==0) echo "No results found for <b>$search</b>"; else { echo "<table bgcolor='#000000' width='80%' height='1px' align='center'><br /></table><table bgcolor='#000000' width='80%' height='10px' align='center'><tr><td><div align='right'><font color='#E6E6E6'>Showing 1-10 of <b>$foundnum</b> results found for <b>$search.</b></font></div></td></tr></table><p>"; echo "<br>"; while ($runrows = mysql_fetch_assoc($run_two)) { //get data $title = $runrows['film']; $desc = $runrows['description']; $url = $runrows['dl_link']; $imdb = $runrows['imdb']; $pic = $runrows['pic']; $film = $runrows['film']; echo "<table width='900' border='1' align='center'> <tr> <td width='229' align='center'><IMG SRC='$pic'></td> <td class='blacktext' width='655' align='center'><b>$film</b><br /><br />$desc<br /><br /><a href='$url' target='_blank'><b>Download Now</b></a> | <a href='$imdb' target='_blank'><b>IMDb</b></a></td> </tr> </table> "; } ?> <table width='100%'> <tr> <td> <div align="center"> <?php if (!$s<=0) echo "<a href='search.php?search=$search&s=$prev'>Prev</a>"; $i =1; for ($x=0;$x<$foundnum;$x=$x+$e) { echo " <a href='search.php?search=$search&s=$x'>$i</a> "; $i++; } if ($s<$foundnum-$e) echo "<a href='search.php?search=$search&s=$next'>Next</a>"; } } ?> </div> </td> </tr> </table>
-
preg_match('/name="hash" value="([a-zA-Z0-9]+)"/', $hash, $arrMatches); echo $arrMatches[1];
-
try echo "<img src='".$img[rand(0, (count($img)-1))]."' >";
-
if(isset($pages[$submittedvalue])) echo $pages[$submittedvalue];
-
SELECT * FROM characters WHERE characters.statusID = 1 ORDER BY RAND() LIMIT 1; Will give u 1 random record
-
1) make sure countertest.php is in the same folder. 2) Print something at the top of countertest.php just after php tag to see if it is including 3) Write a test php file with only include statement for countertest.php to make sure that works
-
Maintain the pagename.formname => last_submitted pair in session/cookie. While page loading check if the last_submitted for current page and current form in within 1 day [or whatever value you want], disable the form submit button. This will allow you to control the user behavior page and form wise.
-
http://theserverpages.com/php/manual/en/function.readdir.php An Extract. Might be useful !
-
How do i find out where is the error/problem in my code?
samshel replied to laanes's topic in PHP Coding Help
These are just notices. Not sure if they can cause DB related issues. Did you try echoing all queries and running them manually on DB ? That's the easiest and fastest way to find out if all queries in your code are fine. -
This is XML output, if you see on console, you see whatever the response is. however in browser, it will try to parse the content as HTML. As the XML you are getting in response cannot be parse as HTML, it is not displaying in browser. Is the function(1,1) returning you this XML ? If yes, you can try catching that response in a string: $str = function(1,1); Add HTML tags: $str = "<HTML><BODY>".htmlentities($str)."</BODY></HTML>"; echo $str; This will display the complete XML.
-
Can you post some code in your script, it is a parse error. If the new version of the script you bought is working fine alone, that means the parse error is in your script. Posting some code will help to find out what the parse error is.
-
How do i find out where is the error/problem in my code?
samshel replied to laanes's topic in PHP Coding Help
oops ! Sorry ! Missed that.. As mjdamato suggested, try adding more debugging statements. You can echo out all queries and try manually firing them on the Database. -
Well !! to start with posting some code or at least complete contents of the "view source" would help
-
Reading/processing variables imported from MySQL
samshel replied to ElmoTheClown's topic in PHP Coding Help
If i understand you, what you want is dynamic links depending upon the website calling the widget. If this is correct, you have 2 options [as far as i can think]: 1) Keep a companywise copy of your articles in the database as a cache. When you write a new article or edit an existing one, it will re-generate the cache. i.e. If you have 200 companies, it will create 200 records in cache 1 for each company with respective website specific links. For this you need to maintain a list of websites which can call your widget. This is useful when you have big articles, you dont edit/add new ones too frequently [like more than 5 time per hour or so depending on time it takes to generate the cache] and you have manageable number of companies. The cache count will be number of articles * number of companies. With this method, you dont have to do anything on the fly as you will prepare static website wise content before hand. 2) As you already thought about, the second approach would be string replace for the complete article. With 2K words i think it should still be manageable, you have to do your stats and check though. I am not sure I understood your last approach of exploding. Best of luck ! -
How do i find out where is the error/problem in my code?
samshel replied to laanes's topic in PHP Coding Help
or die(mysql_error()); has to be with the query or mysql related operation. It cannot be anywhere in the code. $result=mysql_query($qMain) or die(mysql_error()); -
mysql_query("DELETE FROM items WHERE itemid='$id'") or die(mysql_error());} try changing to: mysql_query("DELETE FROM items WHERE itemid=$id") or die(mysql_error());} remove the single quotes.
-
How can I get Paypal to send variables back to me once completed?
samshel replied to Hobgoblin11's topic in PHP Coding Help
you may want to check Paypal IPN and callback URL -
Yes.. SELECT * FROM table WHERE date BETWEEN '2009-01-01 00:00:00' AND '2009-12-31 11:59:59' would work.
-
just another way of doing it: echo $x_separated = ereg_replace("x", "in x", $row['DIMENSIONS']);
-
try <?php $string = ''; $patterns = array(); $patterns[0] = "/^".$TopicID . "-/"; // For start ids $patterns[1] = "/-".$TopicID . "-/"; // For middle ids $patterns[2] = "/".$TopicID . "$/"; // For end ids $replacements = array(); $replacements[0] = '-'; $replacements[1] = '-'; $replacements[2] = '-'; echo preg_replace($patterns, $replacements, $string); //This should handle all three cases // 1- // 1-1-1 // 1-1 ?> not tested