jcbones
Staff Alumni-
Posts
2,653 -
Joined
-
Last visited
-
Days Won
8
Everything posted by jcbones
-
$keyword_search = ($keywords === 'Keywords' || empty($keywords)) ? '' : "AND job_title LIKE '%$keywords%' OR job_short_desc LIKE '%$keywords%' OR job_long_desc LIKE '%$keywords%'"
-
There is no closing bracket } for the function check_input(). When you see "unexpected $end" it is usually a bracket problem. There are many other problems with the script though. 1. $rand_keys is not defined. 2. case statements make no sense. You are echoing the $_POST['box#'] no matter what the case is, so there is no need for it. 3. concantenation in PHP is with the period( . ) not with the plus sign (+).
-
I am with requinix on this one. I think the problem is with code PLACEMENT, but without more than this little snippet we cannot track down what should go where.
-
I agree with the Psycho, but would add that users who buy software (for end use), most likely, would not have the ability to reverse engineer it. Not to say you should worry about it (or code for it), just that not being able to make it 100% foolproof shouldn't stop you.
-
acapa89, post your current code, a blank page means an error, and there shouldn't be one in the code MMDE provided. We need to verify that it was placed correctly. Better yet, try this. <?php error_reporting(-1); ini_set('display_errors',1); $un = $_POST['Username']; // connect to the db $mysql_host = "localhost"; $mysql_database = "****"; $mysql_user = "*****"; $mysql_password = "*****"; $conn = mysql_connect($mysql_host,$mysql_user,$mysql_password); mysql_select_db($mysql_database,$conn); $query = "SELECT * FROM student WHERE Username='$un'"; echo '$_POST[\'Username\'] = '.$_POST['Username'].'<br/>'; echo '$un = '.$un.'<br/>'; echo '$query = '.$query.'<br/>'; $result = mysql_query($query) or die(mysql_error()); echo mysql_num_rows($result).'<br/>'; while($row = mysql_fetch_assoc($result)){ $result_array[] = $row; } print_r($result_array); //Store all the course code into an array $course_code = mysql_fetch_array($result); //verification if(mysql_num_rows($result) == 1) { echo 1; // for correct login response $format = ".txt"; $output = $un.$format; $fh = fopen($output,'w') or die ("Can't open file"); for($num=1;$num<=5;$num++) { $code = $course_code['Course'.$num]; fwrite($fh,$code."\r\n"); } chmod($output,0777); //chmod the file to 0777 fclose($fh); } else { echo 0; // for incorrect login response } ?>
-
So, $start1, $start2, $start3 has nothing to do with posting the form, it is only database call? Yet, you are using that to determine the state of the button? So, you should either. 1. Check the form submission to set the button. OR, 2. Move the include for safe.php BELOW your updates, so that you pull the info AFTER you update it. (currently you update the info after you pull it).
-
Where do you create the variables. $start, $start2, $start3?
-
Questions should be clear and concise, leaving 0 margin for doubt. The reason you are getting no response is: No One Knows What You Are Talking About! 1. Brief statement of what you are desiring to do. 2. Any code that is relative to the problem. 3. How the output is different than what is desired. Follow those steps, and you will get replies.
-
Repeatedly updating and displaying sql query results
jcbones replied to kehaglund's topic in PHP Coding Help
Your browser is probably caching the page. This should dis-able caching. -
charset problem needing out-of-the-box solution
jcbones replied to ricmetal's topic in PHP Coding Help
You can ask the database to show you the collation of the table for the character set. $sql = "SHOW TABLE STATUS FROM $database LIKE '$table'"; $result = mysql_query($sql) or trigger_error($sql . ' encountered an error!<br />' . mysql_error()); $row = mysql_fetch_assoc($result); foreach($row as $key => $value) { echo $key . ' = ' . $value . ' <br />'; } -
You guys had me going. I always used highlight_file, but I see that show_source is an alias of it. PS. if you only want to highlight a section of code or a "string", use highlight_string.
-
Worked for me. <?php //turn off errors, due to PEAR programmers =P error_reporting(0); ini_set('display_errors',0); require_once("Image/Barcode/Code39.php"); //require 3 in 9 file. $code = 56364357543745; //set the code. $bc = new Image_Barcode_Code39('',2,4); //start our class. header('Content-type: image/png'); //tell the page we want to display a PNG image. (handled automatically through the wrapper class, not directly to 3 in 9 though). imagepng($bc->draw($code, 'png', true, 120)); //draw the barcode, as a PNG file, turning off the text, setting the height at 120px. (use imagepng to create image, handled in the wrapper class, but not directly). ?>
-
Yes, just the one script. It is a runtime setting.
-
No, that shouldn't be a problem. Right after your closing bracket on your while statement, add this code, then copy/paste the array here. We should get it sorted quickly. echo '<pre>' . print_r($categories,true) . '</pre>';
-
<?php //php tag for syntax highlighting $options = array('option1','option2','option3','option4','option5','option6','option7'); //array holding options. if(!in_array($suboption,$options)) { //if suboption is not in the options array. $form->setError($field, "* Unexpected error with option"); //set the error. } There are 100's of ways to do things in PHP, doesn't make them wrong, just different.
-
Making a text adventure in PHP-very basic/beginner
jcbones replied to DeadlyAzn's topic in PHP Coding Help
Yes, $_GET(URI), $_POST(header), $_SESSION(server) can all be used to pass variables from one page to the other. -
OK, So I installed the barcode script (did you note that Barcode2 is out?), and am receiving the same errors as yourself. I did notice that you do not need the header, as that is handled inside the class. So, I did some deeper digging, and it seems that there are quite a few notices thrown in this script. So, I'm going to do something I do not believe I have ever done before. I suggest turning error reporting OFF. Run this script, and see what it gives you. <?php error_reporting(0); ini_set('display_errors',0); require_once('Image/Barcode.php'); Image_Barcode::draw('1234','Code39', 'png'); ?>
-
I'm not getting an error on that line. Running your code I just get the expected error on not having the VmModel class. Perhaps the error points inside of that? Could you post the whole error, including line number and ending file path. Sometimes the error points to a different file, and people miss that, out of frustration.
-
It is possible that your are throwing errors/notices in the script, thereby causing errors in the image. You will have to de-bug the image script, start by commenting the header, and see if there are errors/notices.
-
Or, you could use a trigger.
-
Truncate script is putting in unwanted numbers...
jcbones replied to ffxpwns's topic in PHP Coding Help
Line: $login = print("Log in to see full article!"); Should be: $login = "Log in to see full article!"; -
You need to find it using preg_match, You can use the multi-line modifier to get URL's that are on a line by themselves, ignoring URL's that are on lines consisting of other characters.
-
Multiple While's, Single Query - Is there a way?
jcbones replied to HCProfessionals's topic in PHP Coding Help
<?php $featured_results = mysql_query("SELECT * FROM products LEFT JOIN product_images ON products.product_id=product_images.product_id WHERE products.product_featured='1' AND products.product_active='1' AND thumb='1'"); $fa=0; while($featured_row = mysql_fetch_assoc($featured_results)) { if ($fa==0) { echo "\n<img id=\"home-slider-photo-".$fa."\" class=\"home-slider-photo preload\" src=\"/includes/getimage.php?img=".$featured_row['image_name']."&w=370&h=370\" alt=\"\" />"; } else { echo "\n<img id=\"home-slider-photo-".$fa."\" class=\"home-slider-photo preload home-slider-photo-unsel\" src=\"/includes/getimage.php?img=".$featured_name['image_name']."&w=370&h=370\" alt=\"\" />"; } $fa++; } echo "<div id=\"home-slider-photo-price\">"; $fb=0; mysql_data_seek($featured_results,0); //return resource pointer to first row of data. while($featured_row2 = mysql_fetch_assoc($featured_results)) { if ($fb==0) { echo "\n<div id=\"home-slider-photo-price-".$fb."\" class=\"home-slider-photo-price\">\n<span>only</span>$".$featured_row2['product_price']."\n</div>"; } else { echo "\n<div id=\"home-slider-photo-price-".$fb."\" class=\"home-slider-photo-price home-slider-photo-price-unsel\">\n<span>only</span>$".$featured_row2['product_price']."\n</div>"; } $fb++; } echo "</div>"; ?> mysql_data_seek -
Images are not uploading onto webpage from phpmyadmin
jcbones replied to jayjay1234's topic in PHP Coding Help
You can use either absolute file paths or relative file paths. Example: <?php echo "<img src=\"http://www.mysite.com/shop/images/{$row['product_image']}\" />"; //absolute path. echo "<img src=\"shop/images/{$row['product_image']}\" />"; //relative path. -
Set a constant with your root location. Then address all of your included files by the root. //in your config file. DEFINE('ROOT_DIR','C:/Software/XAMPP/xampp/htdocs/System_Lords/'); //in your other files require(ROOT_DIR . 'functions/function_battle.php');