Jump to content

[SOLVED] Problem with spaces in db text retrieval


fj1200

Recommended Posts

I'm writing a dispatch note app, all working fine but having problems with job names coming out of a MySQL database text field with spaces in them.  So for example, "TEST JOB 001" comes out as "TEST".

 

Had a look through this forum, tried one or two suggestions but not working.  tried all sorts of combinations with double and single quotes but still not working.  Can anyone assist?

 

I have:

 

  echo "<option value=$SITE_ID"."."."$nt[EXPR3]"."."."$nt[EXPR2]"."."."$JOBTYPE>$nt[EXPR2]</option>";

 

I split the option apart at insert with

 

  $JOB = explode(".",($_POST[JOBNAME]));

 

(may not be pretty but it works well)

 

EXPR2 - job description - is the one causing problems.  We have an internal job code (held in EXPR3) that will be meaningless to the dispatch guys and drivers so the need the description.  It's pulled out of our live SQL Server production database from a read-only view.

Is a very messy way to look at it but if it works for you

 

try this code

 

echo "<option value='".$SITE_ID.".".$nt['EXPR3'].".".$nt['EXPR2'].".".$JOBTYPE."'>".$nt['EXPR2']."</option>";

 

let me know how u get on.

 

Garry

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.