SQL Table Location/Results

This section is for posting questions which are not directly related to WYSIWYG Web Builder.
Examples of off topics: web server configuration, hosting, programming related questions, third party scripts.

Note that these questions will generally not be answered by the administrators of this forum.
Post Reply
User avatar
Exiis
 
 
Posts: 7
Joined: Tue Jan 14, 2014 12:50 pm
Location: Meridian, ID
Contact:

SQL Table Location/Results

Post by Exiis »

Here is the link to the page: https://www.level1firearms.com/cophptest.php

The SQL table appears in the upper-left side of the page.
The code only works if I paste it at "End of Page" in the page properties or the End of Page setting in the Object <>HTML element.
Placing the code in other areas, such as After Body or Use DIV option causes the page to return completely blank.

What am I missing?
Last edited by Exiis on Tue Feb 07, 2017 9:39 am, edited 1 time in total.
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: SQL Table Location/Results

Post by [RZ] »

text (where appears the code you insert) / properties / general / advanced -> do not encode html characters (for advanced users only)
(just tick this option and click ok)

besides this, your code seems incorrect and/or incomplete
Last edited by [RZ] on Tue Feb 07, 2017 9:39 am, edited 1 time in total.
User avatar
Exiis
 
 
Posts: 7
Joined: Tue Jan 14, 2014 12:50 pm
Location: Meridian, ID
Contact:

Re: SQL Table Location/Results

Post by Exiis »

Thanks RZ:

I am not trying to do this with a text object. I'm only using the text object to display the code I'm using to get my database table information. Ideally, I want the table to appear at the end of web page as displayed on the page. .
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: SQL Table Location/Results

Post by [RZ] »

i edited my post
you see the source code instead of the result because it has been escaped, tick the option i told you
and also your code is not correct, structures not closed, vars not defined to make the proper connection to the database, etc...
User avatar
Exiis
 
 
Posts: 7
Joined: Tue Jan 14, 2014 12:50 pm
Location: Meridian, ID
Contact:

Re: SQL Table Location/Results

Post by Exiis »

Thanks Again RZ:

I don't think I'm communicating the issue correctly. The source code is there for you to see it voluntarily; deliberately.

The results I get from the code appears in the upper-left side of the page - that works perfectly...that is the actual results being produced in real-time with the source code I posted.

What I am trying to do is place those results at the bottom of the page and in the middle.

That's the reason why I posted the source code - to gather some direction on how to move the results to the bottom of the page.

If there are other suggestions for improvement, that would be most welcomed. This is the only "customization" to WYSIWYG I every see I would need to do.
User avatar
[RZ]
 
 
Posts: 1914
Joined: Tue Nov 04, 2008 12:08 pm

Re: SQL Table Location/Results

Post by [RZ] »

the code you inserted that apparently works "correct" is not correct and may impact unpredictably on the whole page
User avatar
Pablo
 
Posts: 21578
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: SQL Table Location/Results

Post by Pablo »

The code should be placed in HTML object with 'use div '
Note however that your code is not complete. Closing tags are missing.

Please note that I cannot assist you with programming related issues. The code will be inserted "AS IS".
Just make sure all HTML formatting options are set to 'Default' to prevent your code being processed/formatted.
User avatar
Exiis
 
 
Posts: 7
Joined: Tue Jan 14, 2014 12:50 pm
Location: Meridian, ID
Contact:

Re: SQL Table Location/Results

Post by Exiis »

Pablo:

THANK YOU! :D

Works as expected. For everyone else, I added:

?>

at the end of the code.

Here is how it is after corrections made:

<div style="visibility:visible;">
<?php
$mysql_hostname = "localhost";
$mysql_user = "";
$mysql_password = "";
$mysql_database = "";
$bd = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Oops some thing went wrong");
mysql_select_db($mysql_database, $bd) or die("Oops some thing went wrong");// we are now connected to database

$result = mysql_query("SELECT * FROM `Denver` WHERE `id` ORDER BY RAND() LIMIT 100"); // selecting data through mysql_query()

echo '<table border=0px>'; // opening table tag
echo'<th>Title</th><th>Url</th>'; //table headers

while($data = mysql_fetch_array($result))
{
// we are running a while loop to print all the rows in a table
echo'<tr>'; // printing table row
echo '<td>'.$data['Subject'].'</td><td><a href="'.$data['Url'].'">'.$data['Url'].'</a></td></td> '; // we are looping all data to be printed till last row in the table
echo'</tr>'; // closing table row
}
?>
Post Reply