This is a small piece of code from an Information Scroller I'm using as a news ticker. I have the title of each News Article in a MySQL table. What I need help with is how to take each article's title from the database and place each one into the array above. I'd be happy to clarify if you don't understand what I'm asking.
I am running through a MySQL database using PHP and extracting all of the makes of cars in that database and trying to create a JavaScript array named after each make. Then I am trying to fill each array will all of the models for that make. When I just try to display each Make and Model in an alert box it seems to come up right. And my arrays seem to be getting created but they won't populate with the models (even though my alert msg shows the loops and everything is working).
PHP Code:
while ($row = mysql_fetch_array($result)) { $i=0; //Used so each model is added to the array starting at 0 and ++ $make = $row['make'];//PHP var used to extract data from MySQL
[Code]....
Haven't used JavaScript since a college class a couple of years ago and haven't used it in the real world for even longer. Never with PHP like this. But I am working on this marketing site and need to be able to list products by type according to each brand and as they can be added to a MySQL database it needs to be dynamic. I have the whole thing working by stepping through separate pages using PHP to populate select fields with the data but I want to be able to dynamically add the content to select field using JavaScript so it can all be done on one page and thought that if I could create these arrays on page load then the right information could be selected client side.
I have a database holding roughly 20 fields of data per entry. I want to make only one request to the database, store this information in some manner on my client, and then use javascript to deliver this information to the user. Initially the user will be presented with just a list describing each entry, when clicked upon, all corresponding fields will populate. I know how to do this with javascript fairly easily, but I'm not confident in my methods for getting that data from my database ala php to javascript.
The first thing that comes to mind is to write some PHP code to pull from my DB and then echo out a two dimensional javascript array. I have seen posted elsewhere that this method is not ideal... And I can see why as I always run into issues with attempting this... plus it is ugly as all hell. What is clean way to get all this information onto my client so no subsequent server requests must be made?
I have a jQuery plugin that creates a list of news items and appends the <ul> to the element(s) calling the plugin. Each <li> gets a document key added to its data.
A brief snippet of the code:
(function ($){ $.fn.NewsList=function (options){
[Code].....
None of the <li>'s have the data attached to them. I've tested the selector shown above in line 3, and it does pick up the correct <li>'s. The data is not visible in Firebug as it is on the other page. Both functions are called after document.ready and insert the elements after page load.
The onlydiscernible differences between these two circumstances is that in the working case, the plugin is called against an ID, whereas in the nonworking instance, it is called against a CLASS. In addition, in the working case, only one DIV is affected, and in the nonworking case, there are two DIVs that receive the treatment.
I am trying to get data from mysql into a variable, that should be read by protovis.
I tried /* abfrage_LB.php echoes a json string with the data from mysql */ var parsedData; $.post('abfrage_LB.php', function(data){ parsedData = JSON.parse(JSONdata); });
the error message says, that parsedData is undefined. How can I display, what is in parsedData?
I start to use JQuery and see how is really simple...! I just have a question that I couldn´t find in documentation or here in the forum, andI have a PHP Script that is a combobox with a several textareas. What I would like to do is, select a data in combobox andit will get some data in MySQL database and put it the textarea inputs.The combobox is from name of persons, and the textareas is address, telephone, email, etc... all of them are in MySQL database.
i have a script which i found on the internet. i modify that script according to my needs. what is in that script is there are three form fields with two buttons. one button is "Give me more fields" clicking on this button will give you more fields. and second button is submit so the data goes to server side and will be added to db. the problem is when i click give me more fields it gives me three more fields which is right but when i fill all these fields and click submit button it adds to the db but the data in the first three fields adds in the one row and the other three fields data adds in separate row which is not fine for me. so how can i do this so all the data will be added to only one row.
here is js code
Code:
var counter = 0; //Start a counter. Yes, at 0 function add_phone() { counter++;
I am trying to set up a web based tool for my wife and I to use to balance our checkbook together. I am using HTML, Javascript (Ajax), PHP and MYSQL. I have read beginner books on all of these subjects, I can get data out of MYSQL, BUT can't do it the way I want to do it. If someone could point me to a book, or even the name of what I need to study it would be very helpful. The top line will always be input. But as you submit the top line it refreshes the "growing list" beneath it. (kind of like on-line banking, where you can look at 50 or so lines and then go back further if necessary) The catch is within the "growing list" I want to show Bank and book balance running totals and have three buttons next to each transaction ... EDIT DELETE SUBMIT. If edit is clicked, I want to be able to change that line and then resubmit it to MYSQL.
[Code]...
This way we can both input our transactions as we spend money and know at all times how much money is in the account. What do I need to study to be able to program this?
what i want to do is have a selection from 'tst' trigger an input into 'choose' from the data inputted into the 'fname' and 'lname' fields.
for example, i want option '1', when selected to draw the input from 'fname' and place it into 'choose'
or i might want to select the data in 'lname' instead, so i will tie option 2 to it, so when the user selects option 2 the contents of 'lname' go into 'choose' instead.
I'm triyng to use the $.ajax jquery function to insert some dates in a database, using php.I have the page that insert the data called : sign.php and in the page I have the form, and the ajax scritp.
if I use the page without ajax it works, if I use the script jquery it works but doesn't insert the dates in the field, it send only white field. can't pass the variable POST beetween the ajax script and the php script.
I have a database listing of properties down the page. Each property row has a date selector and a time selector. I need to somehow validate that if one of the dates is selected the time must be selected per property record before the bulk save can happen (or visa versa), if neither are selected it cane be left blank and addressed later. How I can go about validating this using jquery?
The field names are as follows: DATE - data[Property][777][entry_date] TIME - data[Property][777][entry_time] NOTE: 777 is the property ID and changes per record down the screen.
I basically need something such as within a function to run dynamically: if(data[Property][$id][entry_date] <> NULL) { data[Property][$id][entry_time] is required } else if (data[Property][$id][entry_time ] <> NULL) { data[Property][$id][entry_date ] is required }
I want to query a MySQL table when a php webpage initially loads and display the data. Is there a way of executing a php script using the onload() function directly other than using Ajax?
I have a .load that executes a php mysql query from another page. This query displays all the data of the database. Each result is wrapped around a div.
<div id ="post<? echo $row['post_id']; ?>">
the id of the div depends on the post id of the result. How do I put the data of $row['post_id'] in my javascript?
$getChildren will be spit out to my javascript code part where I've place <%getChildren%>. When I try to manually type in the output into the javascript code, it works but not when dynamically.
Not sure if this is the correct forum as it covers data retrieved from mysql in a .js file...
I need to grab the last 5 rows from my database (2 fields per row) and list all 5 in a table but from within a .js file that I can externally link to.
I can manage the php / mysql and the output to a .php page but how can this be contained within a .js file?
I believe it is possible but after 2 days of searching on google I'm appealing for assistance.
I realise this could be done with a php include or iframe but that isn't an option and the only way available to import this data is via an external javascript script.
I have my doubts if this question belongs to the javascript side since it's all good until the data from MySQL comes in, but since the javascript is the one breaking I'll take my chances.
The external js (portada.js)
Code: $(document).ready(function(){ var currentPosition = 0; var currentPosition2 = 0; var currentPosition3 = 0;
[Code]....
As you can see I have three divs with different slideshows (slideshow, slideshow2 and slideshow3), they have products that slide to the left. When I was testing to make sure it all looks good the sliding feature was working fine, but I lost this feature when the data was being retrieved from MySQL (at the moment on <div class="slide">).
i have java script below. i am retrieving states from mysql database and list them dropdown menu. oscommerce, mysql and php. this script works well when it is embedded between head tags to each php file in old version. goes to city_get.php and takes the state result from there. but in the new version (no head tags in php file) i saved the script as js file and try to call from template_top.php (which shows the all the java's way), explorer gives error in the below line. i have followed this error from explorer error messages.