-
Posts
2,965 -
Joined
-
Last visited
Everything posted by mikesta707
-
Note. I also tried putting the query in a hidden HTML field, and tried using that in the http request, to no avail.
-
please put your code in code tags
-
[SOLVED] Help With Showing Users On the Index Page
mikesta707 replied to shorty3's topic in PHP Coding Help
oh. usually when you have parse errors, especially with something that is labeled unexpected, you are either missing something (like a semi colon, or a curly bracket) or have to many of something while ($online_array = mysql_fetch_assoc($select)) { if ($start) { echo $online_array['username']; echo <img src='".$online_array['image']."' />; $start = FALSE; } } else notice something missing here echo ', '.$online_array['username']; }//that should match with this bracket here? echo ' were online recently'; -
[SOLVED] Displaying an image using echo command
mikesta707 replied to ja_blackburn's topic in PHP Coding Help
close echo "<td width='150'><a href='". $row['image_url']."' ><img src='". $row['image_url']."'></a></td>"; two things wrong with yours. one, you didnt end the first part of the <a> tag (so it basically would have looked like <a href=blah <img src=blah /></a> secondly, you didnt have quotes around the href attribute. -
Ok So I have this PHP class that talks to a Javascript class that basically creates a table of information from a database query and puts it in a sortable, filterable table. This all works fine and dandy. Well, i have had the need for some semi-dynamic functionality (changing the table of the query, or changing some other detail) which I accomplished using GETS. This also worked perfectly I wanted to try to add some AJAX functionality in place of the GET functionality, so I changed things around a bit, and now I am sending an xmlhttprequest to my php page. this requests fine. however, I do not get back the information I want. Here is the PHP page that I send the request to require('page.php'); function getAssoc($query, $table){ $svname = 'list_users'; $svuser = 'dmitriyy'; $svpass = 'dmitriyy'; $oracle = new oracle($svname, $svuser, $svpass); //var_dump($oracle); $query = str_replace('REPLACE_ME', $table, $query); //var_dump($query); //echo $query."<br />"; //echo "execute is here bitch"; echo $query; $execute = $oracle->query$query); while(OCIFetchInto($execute, $results, OCI_ASSOC)){ if ($data == null){ $data = array(); $data[] = $results; } else { $data[] = $results; } } return $data; } $query = $_GET['q']; $table = $_GET['t']; print_r(getAssoc($query, $table)); echo "done with print_r"; //echo json_encode(getAssoc($query, $table)); page.php (just a small class that does some oracle database connection and query stuff. This class DOES work, as I use it everywhere) class oracle { //class variables var $connection; /*Constructor *Input (Server name, server usename, server password. By default *server name is localhost, and password and user are blank *returns true if connection was successful, false if not */ function oracle($svname, $svuser, $svpass){ //echo "<script type='text/javascript'>alert('".$svname."');</script>"; try { $conn = oci_connect($svuser, $svpass, $svname); if (!$conn){ throw new Exception("Error"); } } catch(Exception $e){ trigger_error($e->getMessage()); exit(); } $this->connection = $conn; if (!$conn){ echo "<script type='text/javascript'>alert('COULD NOT CONNECT');</script>"; return false; } return true; }//end Constructor //class functions /*query_valid *Input: A query String *Returns the string if it is valid. String cannot have insert or update commands *returns false if it does */ public function is_valid($string){ $temp = strtoupper($string); $invalid_commands = array("INSERT", "DELETE", "UPDATE", "DROP", "TRUNCATE", "APPEND"); foreach($invalid_commands as $c){ if (strpos($temp, $c) !== false){ return false; } } return true; } /*query *Input: A (hopefully valid) oracle query *returns the parsed query if execution was valid *returns false if not */ public function query($query){ if (!$this->is_valid($query)){ die ("Query Contains Illegal Command! Exiting script"); } $do = oci_parse($this->connection, $query); $go = oci_execute($do); if (!$go){ return false; } return $do; } /*BubbleSort2 *Sorts a 2d array, based on a certain column (sorts numerically) *returns the sorted array */ public function BubbleSort2($sort_array,$column = 0,$reverse = true){ $lunghezza=count($sort_array); for ($i = 0; $i < $lunghezza ; $i++){ for ($j = $i + 1; $j < $lunghezza ; $j++){ if($reverse){ if ($sort_array[$i][$column] < $sort_array[$j][$column]){ $tmp = $sort_array[$i]; $sort_array[$i] = $sort_array[$j]; $sort_array[$j] = $tmp; } }else{ if ($sort_array[$i][$column] > $sort_array[$j][$column]){ $tmp = $sort_array[$i]; $sort_array[$i] = $sort_array[$j]; $sort_array[$j] = $tmp; } } } } return $sort_array; } } ignore the bubblesort On the ajax page (the first snippet) everything seems to work fine until I try to build that data array. It just returns empty. I have verified that it is the exact same query on the main page (which executes the query successfully) and the ajax page. One thing to note. I pass the query from php to javascript, and then back to PHP again. I use json_decode when passing to javascript from PHP. However, this doesn't seem to have an effect on the query, as I checked them, and they appear to be the same. Im really at a loss for why this isn't working. is what i'm trying to do possible? I think it is but im not sure any more... anyone have any insight
-
[SOLVED] Displaying an image using echo command
mikesta707 replied to ja_blackburn's topic in PHP Coding Help
by wrapping an <a> tag around it... I don't understand your question... its very simple -
[SOLVED] Help With Showing Users On the Index Page
mikesta707 replied to shorty3's topic in PHP Coding Help
you concatenated wrong echo <img src='".$online_array['image']."' />; should be echo "<img src='".$online_array['image']."' />"; -
include the file on your logout page, and call the function?
-
as I said before, client browsers aren't affected by PHP, but by HTML/CSS/Javascript, etc. I suggest completely validating your XHTML and CSS, and if its completely valid, than consulting the FF developers about a possible bug. but if you say there are a few errors, than those errors could contribute to FF being messed up
-
if you set an auth key in the SESSION variable, don't you think you should be testing if the SESSION variable auth is 0, not the get variable. not to mention that the syntax is all wrong function log_out() { if($_SESSION['auth'] == 0) { session_unset(); session_destroy(); } } but if when a user is logged on, their auth is set to 1, shouldn't you test if its one? { if($_SESSION['auth'] == 1) { session_unset(); session_destroy(); } } ?
-
seems like you got an infinite loop. without seeing the code I can't be of much help. it sounds fine in theory, but it depends on how well (or how correctly) you implemented this.
-
create a database that has a list of logged on users (obviously remove them when the log off). if the user trying to log in is on that list, deny them access. thats how I would do it anyways
-
what exactly is the problem? when I run the following $i = 0; while ($i < 10){ $i++; } echo $i; it echos 10. what don't you understand? how the loop works? why it equals 10?
-
[SOLVED] Help With Showing Users On the Index Page
mikesta707 replied to shorty3's topic in PHP Coding Help
by concatenating it. echo "<img src='".$online_array['image']."' />"; -
[SOLVED] Displaying an image using echo command
mikesta707 replied to ja_blackburn's topic in PHP Coding Help
use code tags next time echo "<td width='200'><img src='". $row['image_url'] .".jpg' ></td>"; you had a lot of intermingles single and double quotes for no apparent reason. close tho. this should do the trick -
forgot the closing parenthesis for the if statement if (isset($_POST['submit']) {//right here //check that no fields have been left blank if (!$_POST['username'] || !$_POST['password'] || !$_POST['email'] || !$_POST['sex'] || !$_POST['day'] || !$_POST['month'] || !$_POST['year'] ) { die('You have not completed the form'); } }//you were also missing this closing curly bracket else {
-
[SOLVED] Display certain image depending on time of year
mikesta707 replied to Daveed1973's topic in PHP Coding Help
there is a topic solved at the end of the posts if your topic has been solved -
turning an array into a string then poping it into a db
mikesta707 replied to gotornot's topic in PHP Coding Help
... did you use it right. this can store a textual representaion of an array (or any object), that can then be unserialized and turned back into the array. Unserializing objects is rather slow however, so be aware of that. alternatively, I suppose you could use json_encode/decode -
Duplicate entry '..' for key 1 error - pls help
mikesta707 replied to cottonbuds2005's topic in PHP Coding Help
im not reading through your entire page that you just slapped in the post. post the relavent code between code/php tags -
[SOLVED] Python program Ideas
mikesta707 replied to mikesta707's topic in Other Programming Languages
wow thanks both of you. I like that note taking program idea a lot, and I think i'll try some of the Project Euler problems too. -
you can get the time for now, and the time for a week later like so $now = time(); $weekLater = strtotime("+1 week"); now its just a matter of using these values along with some sort of data base to get a contest winner
-
PHP has nothing to do with the client's browser. Any problems with output you would see are due to HTML/CSS/Javascript problems. but as far as your rendered HTML goes, I don't see how firefox would interpret that as something else. Is there anything else that may cause a problem in your script? Edit: didn't even read the blurb abuot the div tags. post the relevant html for that page, including the div tags
-
did you just copy paste neil johnson's code? he said you can finish off for a reason. look at what he did here .(($id[$key] == $intref[$key]) ? "<strong>".$intref[$key]."</strong>" : $intref[$key]). and apply that logic where you need to
-
ahh oops i missread your post, do as garethp said
-
have a look at wordwrap()