-
Posts
3,145 -
Joined
-
Last visited
-
Days Won
37
Everything posted by cyberRobot
-
It might help to post the code instead of attaching a ZIP file. When posting code, please surround it with tags. Also, when PHP says there's an error on a specific line, it doesn't always mean that the error is on that line. Perhaps something before line 2 is causing the issue.
-
What does your code look like now?
-
Also note that your query needs to be updated to get the data from the "d_name" column. Right now it only retrieves information from the "complain" column. $sql="SELECT complain FROM complaint c WHERE c.d_name = '" . mysql_real_escape_string($comp) . "'";
-
Ahh...Ch0cu3r beat me to it. At least there's a typo to fix. <?php $comp = $_GET['comp']; $sql="SELECT complain FROM complaint c WHERE c.d_name = '" . mysql_real_escape_string($comp) . "'"; ?> Should be "mysql_"...not "msyql_"
-
One way is to use mysql_real_escape_string(): http://php.net/mysql_real_escape_string Note that mysql_ functions have been depreciated. If you're not doing so already, it's time to start looking into an alternative: http://www.php.net/manual/en/mysqlinfo.api.choosing.php
-
really curious how to store or retrive images
cyberRobot replied to desjardins2010's topic in PHP Coding Help
Minor correction...this echo '<img src="' . $row['image_path']; '" />'; Should be echo '<img src="' . $row['image_path'] . '" />'; -
You could use explode(): http://www.php.net/explode
-
Validating a US Phone number - basic facts
cyberRobot replied to Love2c0de's topic in PHP Coding Help
Keep in mind that some people use extensions. Of course, that could be included in a separate field. -
Also, have you checked with your website host? Perhaps they could restore the website to a previous state if they've been backing up the files. Or maybe they could review the server logs to see what has changed.
-
Does the third-party still have access to the website? If so, I would recommend removing that access first. Note that it might be helpful to know how the third-party was accessing the website. Did they have a login to a CMS, full FTP access, access to the admin panel for the website host?
-
Anybody knows PHP based dashboard library ?
cyberRobot replied to moonlight's topic in Other Libraries
You could also look into using amCharts: http://www.amcharts.com/ -
replace backgrounf images on page with a new image
cyberRobot replied to toolman's topic in Javascript Help
It looks like you have a space in your class name. The space actually causes the <td> tag to have two classes "my" and "class". Try removing the space. -
In login.php, the while loop stores the data in a variable called $row. Within the loop, however, you use $_row. while($row = mysql_fetch_array($query)){ $username = $_row['username'];
-
For what it's worth, the embed code suggested by YouTube looks slightly different than what you have. <iframe width="560" height="315" src="http://www.youtube.com/embed/nbp3Ra3Yp74" frameborder="0" allowfullscreen></iframe> Also note that the website address is formatted differently than regular YouTube links.
-
PHP page not loading image until first button press
cyberRobot replied to sparkynerd's topic in PHP Coding Help
Also note that the code could be further streamlined by using file_put_contents(): http://php.net/file_put_contents This function opens, writes to, and closes a file with one function call. -
PHP page not loading image until first button press
cyberRobot replied to sparkynerd's topic in PHP Coding Help
The first bit of code which initializes the on/off state could be streamlined. For example, you could try something like this: <?php //INITIALIZE VARIABLES $validStatus = array('ON', 'OFF'); //IF LED2 ISN'T SET OR CONTAINS AN INVALID STATUS, GET STATUS FROM TEXT FILE if(!isset($_POST['LED2']) || !in_array($_POST['LED2'], $validStatus)) { $_POST['LED2'] = file_get_contents('LED_Status.txt'); } if($_POST['LED2'] == 'ON') { //perform 'ON' state code } elseif ($_POST['LED2'] == 'OFF') { //perform 'OFF state code } //perform the rest of your code ?> Note that the new code is untested. Also, I added a quick check to see if the $_POST variable contains a valid value ("ON" or "OFF"). -
All of the quotes need to be escaped or changed. You could try echo '<iframe src="' . $id . '" allowfullscreen="no" frameborder="0" height="125" width="182">'; Or echo "<iframe src='$id' allowfullscreen='no' frameborder='0' height='125' width='182'>";
-
PHP page not loading image until first button press
cyberRobot replied to sparkynerd's topic in PHP Coding Help
Before running the code that sets $image, you could initialize the variable to whatever the image should be when nothing has been clicked. -
See Reply 3...the OP doesn't want the image to be too tall. The only way I can think of is to modify the image so it fits the allocated space. Perhaps the image could be cropped to fit better. Or the image could fade into a solid color.
-
You could try something like the following: <?php while($row = mysql_fetch_assoc($result)) { $OneDel = array(); //reset array for($i=1; $i<=4; $i++) { if(!empty($row["OneDel$i"])){ $OneDel[$i] = 1; } } print '<pre>' . print_r($OneDel, true) . '</pre>'; } ?> Note that I changed mysql_fetch_array() to mysql_fetch_assoc(). Also be aware that mysql_ functions have been depreciated. At some point, if you're not doing so already, you'll need to look into an alternative: http://php.net/manual/en/mysqlinfo.api.choosing.php
-
What are the exact errors?
-
keeping user input after error and success message
cyberRobot replied to lukew96's topic in PHP Coding Help
Based on the form code posted, the "clientname" variable needs to be moved inside the value attribute. To avoid the undefined index error, you can use an isset() test. Instead of this <tr> <td>Client name:</td> <input type="text" name="clientname" value="" <?php echo htmlspecialchars($_POST['clientname']); ?>> <td><span class="error">* <?php if (isset($errors['clientname'])) echo $errors['clientname']; ?></span></td> </tr> Try <tr> <td>Client name:</td> <input type="text" name="clientname" value="<?php if(isset($_POST['clientname'])) { echo htmlspecialchars($_POST['clientname']); } ?>"> <td><span class="error">* <?php if (isset($errors['clientname'])) echo $errors['clientname']; ?></span></td> </tr> -
keeping user input after error and success message
cyberRobot replied to lukew96's topic in PHP Coding Help
Have the POST variables been set? For example, are you using the POST variables directly after a form has been submitted? You'll also want to make sure you're using the correct case and name for the index values. In other words, "clientname" in $_POST['clientname'] needs to match the exact name you gave the corresponding form field. If you need further assistance, it may help to show more code. -
How to call out for the information in the database?
cyberRobot replied to goingcrazythankstophp's topic in PHP Coding Help
It would help to know a little more information. For example: Which database are you using MySQL? If you're using MySQL, which connection API are you using...MySQL, MySQLi, PDO? Are you familiar with the basics of pulling information from a database? How have you tried to solve the problem? In general, you could count the number of students by using mysql_num_rows(). Note that mysql_ functions have been depreciated in favor of MySQLi and PDO. More information here: http://www.php.net/mysql_num_rows You could also consider using MySQL's count() function: http://dev.mysql.com/doc/refman/5.1/en/counting-rows.html -
keeping user input after error and success message
cyberRobot replied to lukew96's topic in PHP Coding Help
Variables are case sensitive, try <input type="text" name="clientname" value="<?php echo htmlspecialchars($_POST['clientname']); ?>> Note that I used $_POST <-- upper case