cgull 25 Light Poster

Hello,

I have a database where I insert records into, in Hebrew.

One of the fields needs to have quotes in it.

Then I need to use this field as the title attribute in an image tag.

I got confused with all the different functions: mysql_real_escape_string, addslashes, stripslashes etc.

Up to now I have inserted records into the table in phpMyAdmin.
I tried with slashes like: \"רכב\" and with & like: &רכב& and like that: "רכב"

Whatever I've tried, the code breaks.
For example, it shows only the slash from the title, or the title without any slashes, or nothing etc.

My code for reading:

$result = $con->query("select * from slides where cat_id = $catId and slide_id=1 order by cat_id, slide_id DESC");
	while($row = $con->fetchArray($result))
	{
		$imgId = $row->slide_id;
		$title = $row->slide_title;

		$alt = $row->slide_alt;

		if($imgId < 10)
			$imgId = '00' . $imgId;
		else
			$imgId = '0' . $imgId;

		$img = $imgId . '.jpg';
		$tUrl = $url . "/thumbs";

		echo "
      	<li>
        	<a href=\"$url/$img\">
          	[B]<img src=\"$tUrl/$img\" class=\"image0\" title=\"$title\" alt=\"$alt\" />[/B]
          </a>
				</li>
		";
	}

I also tried this code:

echo <<<LIST
      	<li>
        	<a href="$url/$img">
          	[B]<img src="$tUrl/$img" class="image0" title="$title" alt="$alt" />[/B]
          </a>
				</li>
LIST;
	}

Can someone help me and tell me how to insert the record to the database and how to read it?

Thank you very much.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.