Storing The Result Of Javascript Function
how do I store the result of a javascript function into a PHP variable? I have a div that is hidden or shown based on whether or not a checkbox is clicked. Initially the div needs to be hidden.
So how do i make sure that it will be hidden in all browsers when the page loads. The code for hiding and unhiding it works in the different browsers i have tried, but not initially being hidden. attached is what I currently have.
View Complete Forum Thread with Replies
Related Forum Messages:
How To Add Function Result To Array?
The way I'd like to set up a particular set of functions is to have them either return TRUE or, for example: $errors[type] = "Sorry, the file type is not allowed. Allowed types are ".print_array_inline($acceptedTypes).". "; Then later, I have a foreach loop that echos each array element. However, when I echo each array element is doesn't output the whatever the print_array_inline function does. Any suggestions?
View Replies !
Query Result Navigator Function
I've just updated this, and I thought I'd also say that not only can this provide a page navigation for MySQL or other database results, but can be used to navigate other lists.. such as a file list. PHP Code:
View Replies !
Adding Result Row To Mail Function
I have an email script that will pull the addreses from my club membership database. That part works fine. the problem I am having is being able to include row results inside of the actual email message. My message variable is something like this: Code:
View Replies !
Saving Result Of Function Without Being Echoed
I am trying to save the function "rand(1, 1000000)" in a variable but when I am for example trying: $randomnumber = rand(1, 1000000); it is executing it right ahead while when i try $randomnumber = "rand(1, 1000000)"; or $randomnumber = 'rand(1, 1000000)' It is saving rand(1, 1000000) as variable. But what I need is a variable saving the result of rand(1, 1000000) so the number does not change either. Any ideas how I would do this?
View Replies !
MySQL Result To Real Array In Function
I'd like to create a function which input is the result of a mySQL query. The output should be exactly the same, only not a mySQL result array, but a 'real' array. So it should also get the fieldnames returned by mySQL and use those as keys. I can't get things to work properly: it should return a multidimensional array, like $result_array[1] = array( [field1] => field1 value, [field2] => field2 value, etc. ) somehow my result is (with code below) $result_array[1] = array( [0] => field1 value, [field1] => field1 value, [1] => field2 value, [field2] => field2 value, etc. ) +++++ code ++++++ $get_res= mysql_query(QUERY); if( $res = mysql_fetch_array( $get_res ) ) { do{ $result[] = $res; }while( $res = mysql_fetch_array( $get_res ) ); }; foreach( $result as $key => $value ){ print_r($value); };
View Replies !
Assign MySQL Function Result To PHP Variable
I know to use: mysql_fetch_row($result) to convert a row from a SQL query result set into an array for use with PHP. but in the case of SQL queries that return one value, such as calls to MySQL functions, is there another PHP mysql api function I should use. For example, right now I use a "workaround" technique from PHPBuilder: $result=mysql_query("SELECT COUNT(*) FROM tablename"); list($numrows)=mysql_fetch_row($result); Rather than using this "workaround" code is there a way to simply assign the result of the MySQL function query to a variable. $result=mysql_query("SELECT COUNT(*) FROM tablename"); $numrows=mysteryfunction($result);
View Replies !
Chmode With Mkidir Function, The Result Isn't As Expected
I've tried to create a directory with the php function mkdir(). I've used a "0777" mode , so that owner,group and other can read,write and exectue files in this directory. There's no problem creating the directory, but after it has been created, its mode is "0755". Where did I commit a mistake ?
View Replies !
Using The Function Prevents Accessing The Result Of The Match.
I don't know if this is possible, but it should be. However, it doesn't seem to be working for me. how I can get it to work: I use :||: for my delimiter for str_replace, etc. When replying, the new PM is appended in front of the existing chain of replies, thus the same table entry is used and updated each time. Problem is in storing the sent date, and providing time zone and format adjustments: $string='This is the message that was sent on :|1161850848|:' $newString=preg_replace('/([0-9]*)/',format_time(adjust_time('${1}')),$string); // the result of this is as if ${1} = 0 $newString=preg_replace('/([0-9]*)/','${1}',$string); // returns 'This is the message that was sent on 1161850848' It seems that using the function prevents accessing the result of the match.
View Replies !
Search Function That Highlight Result Instead Of Filtering It Out
I am trying to create a search function that will jump to the page containing the result and highlight it instead of filtering it out. To more clearly illustrate what I mean take a look at this link: I would like to search for eg. "bruce wayne" (its record number 30) and just have that row highlighted. Anybody who could steer me in the right direction would be a massive help as I've spent the last 2 days trying to work this out with no joy.
View Replies !
Function To Test If Mysql_fetch_array($result) Pointing Last Record?
I try to perform multiple insert statment, but the problem is in the below codes, the last sql concatenation ends with ",". I wonder if there is any php function to test if the $result set contains the last record. ------------------ //Get topic id of vote_topic from last insert record $sql_topic_id = "SELECT topic_id FROM vote_topic ORDER BY topic_id DESC LIMIT 1"; $result = mysql_query($sql_topic_id,$conn); $row = mysql_fetch_array($result); //Get all student info from stuinfo $sql_strn = "SELECT strn from stuinfo"; $result1 = mysql_query($sql_strn,$conn); //Dump all student strn into vote_status. //Multiple insert statement? How? $sql2 = "INSERT INTO vote_status (strn,topic_id) VALUES "; while ($row1 = mysql_fetch_array($result1)){ $sql2 .= "VALUES ('".$row1[strn]."','".$row[topic_id]."'),";} mysql_query($sql2,$conn); ---------------------
View Replies !
Refreshing Cache Through Php Header Function Yields No Result?
I am building a website for a client. He wants a login page with a "Your account" page for his clients. I am using a combination of javascript and php. Upon succesful login $_SESSION variables are set to 1. example: $_SESSION['logged']= 1; If the client logs out due to idle time or pressing 'logout' these values are set to zero. example: $_SESSION['logged']= 0; Upon loading of "your account" and any of its sub-pages, that page checks $_SESSION['logged']. If the value is zero it redirects automatically back to the login page. Providing oppertunity to log in again if you wish. The checking of $_SESSION['logged'] is supposed to redirect even if the client has logged out, but has pressed "back" on the browser to try and see a login page. The page does not do this. Pressing "back" reveals the page. Interacting with the page or pressing "refresh" THEN causes it to redirect. I need the page to auto-redirect, not show. I am aware that it is the page being cached and keeping those values until you interact with it. I have fully tested the header function in php. Using 'must-revalidate' & 'no-cache' and other version! (most info from php.net). I get no errors when testing the pages, so my code is correctly spelled! But there is simply no reaction by the page, it just does what it does, which is not what it is supposed to do? I ask for experience! Is there a specific way of doing the header functions? Perhaps it must be placed in a specific place in the page? And how can i check that the page is actually using the functions and not just moving over them with no action taken?
View Replies !
Warning: Mysql_result() [function.mysql-result]: Unable To Jump To Row 0
i want to grab the value of a sql entry. but the thing is, sometimes this value is <NULL>. i thought, no biggy, i'll just have an if statement: if (is_numeric(mysql_result($query, 0))) { //do something } else { //do something else using mysql_result($category_id_query, 0); } however, this doe not work. i get this error: Warning: mysql_result() [function.mysql-result]: Unable to jump to row 0 on MySQL result index 3 is there a way to check to see if mysql_result() is <NULL> without throwing an error.
View Replies !
Displaying Result 1-8, Then Result 9-17 Etc.
I dispaly the results from the database like this. <? while ($row = mysql_fetch_array($prod_result)) { $small = $row[0]; echo"<td align=center><img src="produkter/hardware/decks/$small"></strong></td>";}?> But if there are more than 8 results, I wnat to dispaly the first 8 on one page, then the next 8 on the next page...How can this be done?
View Replies !
Nesting Result Loops Within Result Loops Possible?
I'm looping through a query, and inside the while result output, I am trying to loop through a second query (created from the 1st query's row results). I have checked that both queries return info. I can see that the 1st while result output works fine, but when I get to the inner while result output, it never returns any rows (nothing in the while loop evaluates). So, IS it possible to nest one query's output loop within another, or am I doing something wrong?
View Replies !
Creating A Result Page From A Result Page...
I have a contact management database (4500 records) where each record contains many columns = a lot of data to look at in one go. So... I have created a search page to look for "Company" or "Name" which then returns a recordset with a primary ID number and a summary of 5 other fields. This recordset is then displayed on a results page in a dynamic repeating table which just shows simple record lines. My aim is to then be able to go from the results page to another detailed result page based on the ID of a specific selected record. I understand how to generate the recordset from a text box but cannot find out how to create a recordset from a dynamic repeating table.
View Replies !
Storing XML
I'm designing a website that will use XML to store all the content of my web pages. I will use a PHP script to parse the XML. Should I store the XML in a MySQL database or should I simply store the XML in *.xml files on my server? Which would would yield better performance? And would using one PHP script to parse all the pages be too much on one script (I'll have about 600 pages)?
View Replies !
Storing Vs Not
printing $database[somevar] a couple times in your code or manipulting it, such as multiplying it by 2, or storing it under $myvar and using $myvar.
View Replies !
Storing Data
Say I have a number: number = 34043923, this represents a wordID, so the word belonging to this wordID is say: forum (whatever). This can be stored in 4 bytes (so i am told ) BUT when I save it with fopen/fwrite it takes up 8 bytes (1 for every character) and the file can be read (when opening the file it just reads 34043923). How can I store this data so it takes up only 4 bytes AND how can I do this storing it in a textfield of a mysql db?
View Replies !
Cookie Storing
I have this script so far: <? session_start(); if (!isset($_SESSION['track'])) { $_SESSION['track'] = 0; } else { $_SESSION['track']++; } ?> Which sets a cookie. I can also check if the cookie exists when the user goes to another page. How do you store information in the cookie? For example if I want to store a number like 1200, and then get that information from the cookie again when they go to another page?
View Replies !
Storing Classes
I have a script which calls up a class stored in a file FormatText.class . I don't want my .class files to be accessible if anyone types the URL of the class - I only want my class file accessible by a PHP script called by my server. I use require_once "FormatText.class";o get the class. Where do people typically place the class files when designing software? Shoud I put it in the root folder? I also have a text file I often call that contains sensitive database information. I placed that file in the main directory, (one up from the www directory). How safe is that file? Is that standard practice?
View Replies !
Storing Dates?
i am trying to design a script for sending mot reminders out 2 clients they sign up online then 10days before there mot expires the script sends a e-mail out reminding them what would be the best way to store the dates in my database?
View Replies !
Storing Array In A Row
I run a site with staff-submitted reviews, and most of them are written by one author. However, we also do "multiple" reviews. Up until now I just had a userid for a 'Multiple' account and submitted them under that, but this makes it harder to print lists of all the reviews by one person, so ideally I wanna make a multiple select form so we can just select all the contributors and have the values saved in the database - in one row (something like "56,34,21" etc). I've coded a multiple select form with all the authors of articles for my site on, and I want to store the results of this in one row so I can grab them as an array later - how can I go about doing this? I just googled and came across using <select name="author[]"> in my HTML, and then using serialize() to process it, but it fails. When I run the following code, the value for 'multiplearray' remains at 0 whether I select single OR multiple values on the form: <?php $dbhost = ### $dbuser = ### $dbpass = ### $dbname = ### $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); if(isset($_POST['save'])) { $author = serialize($_POST['author']); $query = "INSERT INTO review_test (multiplearray) VALUES ('$author')"; mysql_query($query) or die('Error ,query failed'); echo "Query successful!"; } echo "<form name='test' method='post' action=''>"; $query2 = "SELECT Staff_id, displayname FROM users WHERE userlevel !=0 ORDER BY username"; $result2 = mysql_query($query2) or die('Error : ' . mysql_error()); echo "<select name='author[]' id='author[]' multiple='multiple' size=ཆ'>"; while($row2 = mysql_fetch_array($result2, MYSQL_NUM)) { list($Staff_id, $displayname) = $row2; echo "<option value='$Staff_id'>$displayname</option>"; } echo "</select>"; echo "<br><br><input name='save' type='submit' id='save' value='Post Review'>"; echo "</form>"; ?>
View Replies !
Storing Dates In DB
What do you think is the best way to store Dates into a database ? If you want to keep logs or buckups.... I am using date('dmYHis') but I doesn't work really well ... Is it better to use date(U) ?
View Replies !
Session Not Storing ID
I am attempting to create a login in script using a session variable to hold the user id. I have got the log in facility working. Just before I redirect the user I set the session variable to the ID. Then when I get to the next page I check to see if the session exists, if it does then I output it. The only problem is that instead of outputting the ID I keep getting 'Session ID: Resource id #7' Code:
View Replies !
Storing Sessions
Can anyone tell me what is the best way to store sessions into database in order to recognize that user next time he access the site?I thought about IP address but then I remembered that it is different every time.What thing regarding a user is always the same?
View Replies !
Storing Results For Later Use?
Is it possible to store results that are parsed from an xml file and then use them on a different web page? Basically I want to store the data within the nodes and then use that data on another web page. Kinda like adding pagination but instead of gettign the info from a db I am getting it from a xml file. Code:
View Replies !
Storing Sessions...
Does it matter how and where they're stored? I was reading through this tutorial and I can across a discussion on where sessions are stored. I was under the impression that this wasn't something I had to worry about..
View Replies !
Storing SQL In A XML File
I'm trying to store a sql statement in a xml file like so: <sql>"SELECT customers.customers_email_address, customers.customers_password,can_seller_profiles.seller_social_name,manufacturers.manufacturers_imag e FROM customers ,can_seller_profiles ,manufacturers WHERE customers.customers_id = '$acc_id' AND can_seller_profiles.seller_customers_id = '$acc_id' AND manufacturers.manufacturers_id = '$seller_man_id'"</sql> but when I echo the the sql in php the vars aren't being populated. I'm trying to avoid hard coding the statements do theres something like 30 plus statements.
View Replies !
Storing The Value Of A Textbox
I have a form with a textbox and A submit button. I want the value of the textbox to be stored in a variable so as to pass through to other pages. I have reached this point: page 1 <?php session_start(); if (isset($_POST['txtusername']))    $_SESSION['test'] = $_POST['txtusername']; $_SESSION['test'] = ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled Document</title> Im testing it both on localhost and web server. Unfortunately, the opening page is blank.
View Replies !
Mp3 / Pdf Storing Into Database
What's disadvantages of storing mp3/pdf/doc files into database instead of uploading to a folder . If you store into database its very easy to restrict user to download the files.
View Replies !
Storing Passwords
How do you guys go about filtering passwords before storing name. I have my username filter set to only allow numbers and letters but not how to implement a filter for passwords as people may prefer using characters, for better protection, which may inadvertently lead to cross scripting vulnerabilities.
View Replies !
Storing Arrays
Im trying to figure out a good way to store an array in mysql, and be able to retrieve the entire array, back into an array. Im building a form that allows authors to submit "Tags" for their books, so people can search on these "Tags" and it will search the Authors table in mysql for matching tags, so that readers can simply enter a tag, and find books that match the tags. For example: Thru a form, an author might type php,mysql,development - Those would then by submitted by a form, So what function could i use to put those into an array? Then how would i store the array in mysql and be able to retrieve it back into an array, for example /author.php?author=mike If mike's tags were php,mysql,development id like to list that on the php page next to his book. So what im trying to do is, 1. Get comma seperated values and put them into an array. 2. Store the array in mysql, and be able to retrieve it back into an array(i know database functions, just not sure what datatype i should use for the column to store these in).
View Replies !
Storing Settings In A DB
I have a table containing two fields, `name` and `value`. Is it possible to loop through all rows in the table, and assign a variable of with the name stored in `name` and value `value`? It's the storing variables when you don't know the name of the variable you're creating that's a problem.
View Replies !
Storing XML In MySQL
What I am trying to accopmlish is to somehow store XML data into MySQL (using PHP I'm guessing). Can anyone point me in the right direction to get started?
View Replies !
Storing Translations
-translations for different languages are stored in .ini files. -the choosen language is stored in a $_session['lang'] variable. -for every file accessed i load the .ini file representing the $_session['lang'] and store it in the _strings() array.and use those strings for substitution. The Question: is it better if i store the translated text once in a similar $_session variable for use during the whole session.or better to create a new instance of the i18n class and reload the .ini translation file for every new page the user access?
View Replies !
Storing App Settings
storing settings in php files like this: File : settings.php <?php $settings['cacheDir']='cache_directory' $settings['templateDir']='template directory' ?> File: index.php require_once("settings.php"); is is secure enough or should i store those settings in constants instead? i mean is there any chance that the user can override those settings when accessing the index.php page from the web?
View Replies !
Storing _FILES
how do you store all the information inside _FILES[] when you do a post. How long does a file stay in the temp dir before you have to move it or it gets deleted. I need to know this because I want one php file to have the upload GUI and another to actually store the file on the server but I do not know how to pass the file information between the two.
View Replies !
Storing An Image
<?php header('Content-type: image/jpeg'); $filename="downloads/Image/large/21-47-110-1.jpg"; $img_temp = imagecreatefromjpeg($filename); $img_thumb=imagecreatetruecolor(132,99); imagecopyresampled($img_thumb,$img_temp,0,0,0,0,132,99,imagesx($img_temp),imagesy($img_temp)); imagejpeg($img_thumb, "", 60); //this is the bit I am not sure about. $handle = fopen("downloads/Image/large/test.jpg", "a"); fwrite($handle, $img_thumb); fclose($handle); imagedestroy($img_thumb); ?>
View Replies !
Storing Same Values
I'm working with my MySQL database and had a question. How would you store two of the same values within the same column? I have three: loginName, id (auto_increment), and Image. How would I make it so that loginName can store the same values multiple times? Does it have anything to do with primary, unique, and index keys? Becuase I'm in phpMyadmin right now and I'm tempted to start pressing buttons to find out what they do.
View Replies !
Storing MySQL
I need to store results from a MySQL call to a multidimensional array. My code is as follows: Code: $db = mysql_connect("localhost", "admin", "password"); mysql_select_db("myDatabase",$db); $query = "SELECT * FROM content WHERE filetype LIKE 'URL'"; $result = mysql_query($query); for($i=0;$row = mysql_fetch_array($result);$i++){ $multiResults[$i] = array(mysql_fetch_row($row)); }
View Replies !
Storing Data For Use
I want to store an array on the server for use across multiple pages. I know and have been using sessions, but it just kills me to know that if the user turns cookies off, this is all gonna stop working unless I want that big session id in all urls. Also, the info in this array is by no means specific to each user, its the same for all of them. Is there any alternatives to this? Some way of storing an array which would be accessible by multiple pages.
View Replies !
Storing Object Into Array - OOP
Can I store objects into an array? $anArray[$index] = $anObject; $anArray[$index]->aMethod(); I have problems executing the above code. Does anyone knows a better/correct way of doing it? How do I invoke a method belonging to that object?
View Replies !
Storing Image Into BLOB
I am having one problem which is that: - I can upload and store image into BLOB field normally on one machine-winXP where installed Apache 2 and php 4.x - exactly same php code not functioning on the another machine-winXP where running Apache 1.3 and php 4.x What is problem, can I have help from some one? When I check the data stored in BLOB field (by means of saving into Desktop using MySQL Control Center) it were always stored 77 bytes of image/jpeg data, and 66 bytes of image/bmp files!
View Replies !
Storing Object In Session
I'm trying to figure out how to store an object in session. To try this, I have apache2 and php5 running on my windows machine. I used the 2 files below. First i run test.php, which creates the object, puts some data in it, and stores it in the session. test2.php retrieves the object from the session and prints the data. Works fine on my windows machine. However, when I upload these 2 files to my hosting provider, then it does not work anymore. I get no errors, but the object seems to be empty. The provider is running php4.3 ... Can someone help me find a way to fix this? Code:
View Replies !
Storing Current Url In A Variable
I want to store the current page url in variable $link I used $link=$_SERVER['PHP_SELF']; But it gave me only pages.php if the current link is [url]http://www.example.com/pages.php?catid=1&id=3 This is required as i am storing the url in a social bookmarking site ...
View Replies !
Storing A Hierarchy In An Array
I am having some troubles. What I am doing here is dealing with an employee hierarchy that is stored in an array. It looks like this: $employees = array( "user_id" => array( "name", "title", "reports to user id", "start date in the format: mm/dd/yyyy" ) ); How can I display this hierarchy in simple nested <li> tags in the most efficient way possible? I realize that the way this is setup, the hierarchy is essentially a tree. But I am at a loss as to how to pull this data out, sort it, and display it wit nested <li> tags. I am thinking that this is more of a computer science problem.... What I mean by displayed as a hierarchy, is that the nested <li> tags will indent themselves to look like that. Like this: - CEO -- Manager --- Manager's secretary --- Minion -- Manager That sort of thing. I am just lost as to how I can analyze the structure of the array and turn it in to output like that.
View Replies !
Storing Months In Mysql 4
I'm using PHP 4 and MySQL 4. I want to store the month and year as a single row but I am having difficulty figuring out the best data type to use. I suppose I could use 'DATE' and then always have the day value be equal fto 1, but I figure there's a more elegant approach. I leave it to on e of you experts to recommend one.
View Replies !
Storing Sessions In Mysql
I'm working on a shopping cart which uses sessions and I'm battling with a couple of decisions ... 1) Allow users who don't use cookies Currently I'm passing the SID's in the url for those not allowing cookies. Is there anything I should be considering when displaying SID's in the browsers address? Should I just disallow those not allowing cookies? 2) Store the session ID's and cart contents in mysql for non registered visitors. I can see that there might be a reason to obtain statistics on visitors who fill a cart and don't register, but I can see a lot of redundant data being left in the db. Currently I'm storing everything in an array and then once the visitor has created an account I'm going to input the contents of the array into the db. Does anyone have any personal preference over these design considerations which I may have overlooked?
View Replies !
|