Jump to content

Alistair4267

New Members
  • Posts

    7
  • Joined

  • Last visited

Alistair4267's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Oh my God, it's working THANK you
  2. Just like to add i now get "Undefined index: t_old_text on line 29 $content .= "(text from the page : {$row['t.old_text']}"; Not sure why ?? Cheers Alistair
  3. Ah thanks for that, I now have the alert box showing up but all it shows is "text from the page:" and no variable I bet i have missed something very simple but i just can't see it Cheers Alistair
  4. HI All This is my updated code. <?php $dbhost = 'localhost:3036'; $dbuser = 'Dbuser'; $dbpass = 'MyPassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = "SELECT t.old_text FROM my_wiki.page p INNER JOIN my_wiki.revision r ON p.page_latest = r.rev_id INNER JOIN my_wiki.text t ON r.rev_text_id = t.old_id WHERE p.page_id = 208"; mysql_select_db('my_wiki.text'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data...' . mysql_error()); } $content = ""; while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { $content .= "(text from the page : {$row['t.old_text']}"; } echo ' <script type="text/javascript"> { alert(' . {$content} . '); } </script>'; ?> For some reason nothing happens. Cheers Alistair
  5. Hi Please ignore the above, i was looking at a different script. I am now getting "Object doesn't support this property or method" Cheers Alistair
  6. Hi The above code works a treat (cheers). I have change the "page_id" to page_title but the alert box is coming back a "Null" ?? I can confirm that the .php file is saved as UFT-8 so i am a little stumped on how to resolve this. Cheers Alistair
  7. Hi All I have the following code which works great but i can't seem to figure out how to get the "result" from the database to be displayed in a alert box. Please could someone point me in the right direction or sugguest some way i could achieve this. <?php $dbhost = 'localhost:3036'; $dbuser = 'Dbuser'; $dbpass = 'Mypassword'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $sql = 'SELECT page_id FROM page WHERE page_id=112'; mysql_select_db('my_wiki'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not get data: ' . mysql_error()); } while($row = mysql_fetch_array($retval, MYSQL_ASSOC)) { echo "Page ID :{$row['page_id']} <br> ". "--------------------------------<br>"; } echo "Fetched data successfully\n"; mysql_close($conn); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.