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
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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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