Jump to content

select query using javascript


likemaddy

Recommended Posts

Hi To Every one.

 

This is my first day on phpfreaks. i am here becouse of java script problerm.

 

i have a table of images in mysql and i want to show all the images as pop up.

i dont want to submit the page thats why i prefer javascript for this.

 

i am also new for php and javascript.

can please any body help me ?

 

Thanks in advance

Link to comment
https://forums.phpfreaks.com/topic/266204-select-query-using-javascript/
Share on other sites

i have the all images in php array.

 

$array[$i];

 

and i can pop also using the script

 

    window.open("file_display.php?id=18","Homepage","resizable=no,status=no,scrollbars=no,height=320,width=230,left=490,top=320,menubar=no,addressbar=no");

 

i dont know how can i use array item as id no

 

or

 

i dont know how to run select * from table name query in javascript.

 

help me plz

You can't run a select query directly using JavaScript. Although you can use AJAX, which allows you to send a request in the background to a PHP script to get the results. If you're dealing with a relatively small amount of data though, it might make sense to just to echo the data into a JS variable to start with:

 

<script type="text/javascript">
    var data = <?php echo json_encode($array) ?>;
</script>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.