• We should now be fully online following an overnight outage. Apologies for any inconvenience, we do not expect there to be any further issues.

Calling all PHP and Mysql NINJAS HELP Needed!

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
Ok

Here is my problem folks. I have a Web based PHP application that posts info to a mysql database. The php then fetchs some of this data and displays what is needed to the screen. All of this works well except for one problem. The mysql database does not store spaces in the info the user enters. When I go to display the info it drops all the spaces that are entered by the user. For some strange reason it does seperate words etc. However new paragraphs and tabs are not shown. Can someone please help me out.:(
 

Modeps

Lifer
Oct 24, 2000
17,254
44
91
um, it drops SPACES? sounds like you *may* have the wrong column type defined... try using a blob.
 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
Originally posted by: Modeps
um, it drops SPACES? sounds like you *may* have the wrong column type defined... try using a blob.

Thanks Ross but this is not for web hosting.

Modeos you need were I define the type I have varchar 225 right now should I use blog and that will fix this issue?
 

Modeps

Lifer
Oct 24, 2000
17,254
44
91
Originally posted by: Darkstar757
Originally posted by: Modeps
um, it drops SPACES? sounds like you *may* have the wrong column type defined... try using a blob.

Thanks Ross but this is not for web hosting.

Modeos you need were I define the type I have varchar 225 right now should I use blog and that will fix this issue?

No guarantees, but it's worth a shot. and it's blob, not blog. There's no reason it should be stripping out the spaces, what's your insert query look like?
 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Can you give an example so we know if perhaps you've got the wrong column type?

Show us how much text you're talking about.

Rob
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
Originally posted by: Darkstar757
Originally posted by: kt
Put <pre> and </pre> around your output.

that only seems to have changed the font spacing.

Then use the PHP built in function nl2br() to convert the new line string to the HTML break tag.

nl2br($youroutputstring)


-edit-

BTW, your description of the problem kind of threw us all off course. It's LINE SPACING not SPACES you're talking about.
 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
 

Modeps

Lifer
Oct 24, 2000
17,254
44
91
BTW, your description of the problem kind of threw us all off course. It's LINE SPACING not SPACES you're talking about.
that makes more sense then removing actual spaces...
rolleye.gif
 

Templeton

Senior member
Oct 9, 1999
467
0
0
The problem isn't your sql inserts or retrievals, rather, html ignores all whitespace other then a single space. If you want tabs or newlines to show up, you'll need to insert <br.> and &.nbsp; where needed. (sans periods) You should be able to find some php functions to do this.
 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Originally posted by: Darkstar757
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
Can you actually show us one FULL column of data that has been entered? My guess is the nl2br is what you need, but I can't tell until I see the data (not the insert statement).

i.e. show us what is being entered, and show us how you want it to look.

Rob
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
Originally posted by: Modeps
BTW, your description of the problem kind of threw us all off course. It's LINE SPACING not SPACES you're talking about.
that makes more sense then removing actual spaces...
rolleye.gif

rolleye.gif
 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
Originally posted by: Entity
Originally posted by: Darkstar757
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
Can you actually show us one FULL column of data that has been entered? My guess is the nl2br is what you need, but I can't tell until I see the data (not the insert statement).

i.e. show us what is being entered, and show us how you want it to look.

Rob

Well the only colum im concernd with is the daily status.

This feld may contain something like a write up.

{
the person was able to fix the issue etc.


4/14/04 the issue has been resolved etc.

}


I want the field to show the space between the two sentences.


 

Entity

Lifer
Oct 11, 1999
10,090
0
0
Originally posted by: Darkstar757
Originally posted by: Entity
Originally posted by: Darkstar757
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
Can you actually show us one FULL column of data that has been entered? My guess is the nl2br is what you need, but I can't tell until I see the data (not the insert statement).

i.e. show us what is being entered, and show us how you want it to look.

Rob

Well the only colum im concernd with is the daily status.

This feld may contain something like a write up.

{
the person was able to fix the issue etc.


4/14/04 the issue has been resolved etc.

}


I want the field to show the space between the two sentences.

$dailyin = nl2br($dailyin);
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";

Try that.

Rob
 

kt

Diamond Member
Apr 1, 2000
6,032
1,348
136
Originally posted by: Darkstar757
Originally posted by: Entity
Originally posted by: Darkstar757
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
Can you actually show us one FULL column of data that has been entered? My guess is the nl2br is what you need, but I can't tell until I see the data (not the insert statement).

i.e. show us what is being entered, and show us how you want it to look.

Rob

Well the only colum im concernd with is the daily status.

This feld may contain something like a write up.

{
the person was able to fix the issue etc.


4/14/04 the issue has been resolved etc.

}


I want the field to show the space between the two sentences.

Go back a couple of posts, the answer to your problem is there.

 

Darkstar757

Diamond Member
Feb 1, 2003
3,190
6
81
Originally posted by: Entity
Originally posted by: Darkstar757
Originally posted by: Entity
Originally posted by: Darkstar757
here is the sql insert
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";
$result = mysql_query($sql);


here is sample of part of the php insert statment

Ticket Open Date:<input type="Text" name="datein">

<p><font face="Times New Roman" size="3" color="#0000FF"><b>Priority of the Problem:

<select name="pri[]" multiple>
<option value="High">High</option>
<option value="Medium">Medium</option>
<option value="Low">Low</option>
Can you actually show us one FULL column of data that has been entered? My guess is the nl2br is what you need, but I can't tell until I see the data (not the insert statement).

i.e. show us what is being entered, and show us how you want it to look.

Rob

Well the only colum im concernd with is the daily status.

This feld may contain something like a write up.

{
the person was able to fix the issue etc.


4/14/04 the issue has been resolved etc.

}


I want the field to show the space between the two sentences.

$dailyin = nl2br($dailyin);
$sql = "INSERT INTO calls (naismc, sitename, opendate, priority, problemdescription, dailystatus)
VALUES ('$ismcin', '$sitein', '$datein', '$priin', '$probin', '$dailyin')";

Try that.

Rob




DAMMIT ROB! I LOVE YOU BRO

CHEERS:D:beer:

THAT DID IT IT WORKS!