[PHP-DB] Lost data after space in PHP variables

2015-02-17 Thread Charlie Lewis
I'm not sure that this is entirely the group for my question, so apologise
if it is.

 

I'm losing data in variables that use the assignment of $_POST[]. Any
variable with a space in the $_POST[] loses everything after the space. Is
it that I need to enclose the data with ' or ? I've tried all that with
little success.

 

Thank-you.

 

Charlie

 

 

 



[PHP-DB] Sorting a PHP array

2013-05-15 Thread Charlie Lewis
I have a bookseller database list read into a PHP array with dimensions
[row][field]. There are 32 fields in each record/row and up to 500 records.

 

What is the neatest way to sort the array by any of the fields, such as
author or title?

 

I know I should just search for a manual on this, but could anybody give me
a quick start?

 

Thanks,

 

Charlie

 

 

 



[PHP-DB] Efficient way to access MS SQL server

2008-01-30 Thread charlie
Currently using ODBC to connect to MS SQL server 2005.  Profiling shows that 
to fetch many rows requires a cursor based fetch of each record - a round 
trip to SQL server for each. I would like to use some driver/interface from 
PHP to SQL server that would get all rows in one round trip, or at least a 
smaller number of round trips. The native SQL driver for PHP has a problem 
with a limit on the number of characters in a string, so can't use that.

Is there anything better to use? 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] short text strings with apostrophes and forms

2006-04-20 Thread Charlie van de Kerkhof

Hi Jeffrey,

try this:

print input type='text' name='some_variable'  
value='.htmlspecialchars($some_text).'\n;



Regards,
- Charlie

On 20 Apr 2006, at 17:56, Jeffrey wrote:
I have an application which calls up some data from a MySQL table  
and puts it into a web form for users to modify.
One of the cells holds a text string which is put into a text input  
field. However, if that text string includes an apostrophe, all  
text after the apostrophe disappears.

For example, if the test string from a database cell reads...
Fix the managers' cars by Tuesday
and that is saved in the variable $some_text, which is called up in  
a form...

input type='text' name='some_variable' value='$some_text'
The text field on the web page will only contain...
Fix the managers
How can I get the text field to show the entire string?
Many thanks,
Jeffrey


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] Mysqli Problems with 5.1.0b3

2005-08-14 Thread Charlie Davis

Hey all!

So two days ago, just for kicks, I thought I'd update to 5.1.0b3.

On to my problem.

I use a custom Session class to basically store my session data in MysQL.

Here's my class:

class DBSession
{
static $dbh;

function open($save_path, $session_name)
{
self::$dbh = new mysqli(localhost, ..., ..., lists);
return(true);
}

function close()
{   
return(true);
}

function read($id)
{
$query = select session_data from sessions where session_id = 
'.$id.';
if(!$result = self::$dbh-query($query))
throw new MysqlException($this-dbh);
if($result-num_rows == 0)
{
return ;
}
$row = $result-fetch_assoc();
return $row['session_data'];
}

function write($id, $sess_data)
{
$clean_data = addslashes($sess_data);
*Error Here:	if(self::$dbh-query(update sessions set session_data 
='.$clean_data.', modtime=NOW() where id='.$id.'))

return(true);
else
throw new MysqlException(self::$dbh);
}


function destroy($id)
{
if(self::$dbh-query(delete from sessions where session_id = '$id'))
return(true);
else
return(false);
}

function gc($maxlifetime)
{
$ts = time() - $maxlifetime;
		if(self::$dbh-query(delete from sessions where modtime  
from_unixtimestamp($ts)))

return(true);
else
return(false);
}
}

And the error I get is Warning: Couldn't fetch mysqli in the file at 
the line that starts with a *


This works in 5.0.4. I haven't changed a thing and been beating myself 
against a wall trying to figure this out. Did something change in 5.1 
that I should know about?


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DB] MySQL and datatime field and displaying on page

2002-06-21 Thread Charlie Grosvenor

Hi
I have a mysql table that has a field in it called 'DATETIMEADDED' which
has data type 'datetime' I want to display the contents of the field on my
page. I have tried usng the following code but the value in the
'DATETIMEADDED' only the value in the 'NAME' field which is a varchar is
displayed on the page. How can i get it to display the value in
'DATETIMEADDED'?

ul
?
$query = SELECT *  FROM `BOARDITEMS` WHERE BOARDID=$BOARDID ORDER
BY 'DATETIMEADDED';;
$resultboarditems = mysql_query ($query) or die(Invalid Result
Set);
while ($row = mysql_fetch_array ($resultboarditems)) {
?
li? echo $row[DATETIMEADDED]; ?? echo
$row[NAME]; ?/li
?
}
?
/ul



Thank you

Charlie



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php