<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум PHP-MyAdmin.RU &mdash; Помогите Mysql+PHP]]></title>
	<link rel="self" href="https://forum.php-myadmin.ru/extern.php?action=feed&amp;tid=1854&amp;type=atom" />
	<updated>2010-08-09T14:49:21Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.php-myadmin.ru/viewtopic.php?id=1854</id>
		<entry>
			<title type="html"><![CDATA[Re: Помогите Mysql+PHP]]></title>
			<link rel="alternate" href="https://forum.php-myadmin.ru/viewtopic.php?pid=13007#p13007" />
			<content type="html"><![CDATA[<p>Попробуйте изменить запрос SELECT id,title,date,discription,author FROM lessons&quot;,db<br />на</p><div class="codebox"><pre><code>SELECT `id`, `title`, `date`, `discription`, `author` FROM `lessons`</code></pre></div><p>Базу не надо указывать если до этого Вы установили соединение с базой скрипт использует дескриптор Вашего соединения.<br />Там где Вы указываете имя базы db нужно указывать дескриптор соединения а не имя базы.</p><div class="codebox"><pre><code>resource mysql_query ( string query, [resource link_identifier] )</code></pre></div><p>Например:</p><div class="codebox"><pre><code>$link = mysql_connect(&#039;хост mysql&#039;, &#039;mysql_user&#039;, &#039;mysql_password&#039;);

mysql_select_db(&#039;имя вашей базы&#039;, $link);  // $link - не обязательный параметр.

$query = &#039;SELECT `id`, `title`, `date`, `discription`, `author` FROM `lessons`&#039;;

$result = mysql_query ( $query ) 

$myrow = mysql_fetch_array ($result);

...ваш скрипт...

// Освобождаем память от результата
mysql_free_result($result);

// Закрываем соединение
mysql_close($link);</code></pre></div><p><strong>mysql_query()</strong> посылает запрос активной базе данных сервера, на который ссылается переданный указатель. Если параметр link_identifier опущен, используется последнее открытое соединение.<br />сделать foo текущей базой данных <strong>mysql_select_db(&#039;<em>foo</em>&#039;, $lnk)</strong></p><p>Так же проверьте сделав этот запрос:<br /></p><div class="codebox"><pre><code>SELECT `id`, `title`, `date`, `discription`, `author` FROM `lessons`</code></pre></div><p>в phpMyAdmin и проверьте правильность написания полей и таблицы.</p><br /><p>PS: Если есть возможность использовать классы mysqli используйте их - документацию по ним вы можете найти на <a href="http://www.php.su/functions/?cat=mysqli">http://www.php.su/functions/?cat=mysqli</a></p>]]></content>
			<author>
				<name><![CDATA[DmitryV]]></name>
				<uri>https://forum.php-myadmin.ru/profile.php?id=2987</uri>
			</author>
			<updated>2010-08-09T14:49:21Z</updated>
			<id>https://forum.php-myadmin.ru/viewtopic.php?pid=13007#p13007</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Помогите Mysql+PHP]]></title>
			<link rel="alternate" href="https://forum.php-myadmin.ru/viewtopic.php?pid=13006#p13006" />
			<content type="html"><![CDATA[<p>&lt;?php </p><p>$result = mysql_query (&quot;SELECT id,title,date,discription,author FROM lessons&quot;,db);&nbsp; <strong>Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in </strong></p><p>$myrow = mysql_fetch_array ($result); <strong> Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in</strong></p><br /><p>&nbsp; &nbsp; &nbsp; &nbsp; <br />do {&nbsp; &nbsp; &nbsp; &nbsp; <br />printf (&quot;&lt;table align=&#039;center&#039; class=&#039;lesson&#039;&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;td class=&#039;lesson_title&#039;&gt;%s&lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;td&gt; &lt;/td&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/tr&gt;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&lt;/table&gt;&quot;, $myrow[&quot;title&quot;]);<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<br />&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<br />}</p><p>while ($myrow = mysql_fetch_array ($result));&nbsp; &nbsp;&nbsp; <strong>Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in &nbsp; &nbsp;&nbsp; &nbsp;</strong><br />?&gt;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;</p><p>Помогите пожалуйста!!!!!!!!!!!!!!!!!!!!!!!!<br />Не могу решить проблему</p>]]></content>
			<author>
				<name><![CDATA[sTaNdInG]]></name>
				<uri>https://forum.php-myadmin.ru/profile.php?id=2994</uri>
			</author>
			<updated>2010-08-09T13:58:25Z</updated>
			<id>https://forum.php-myadmin.ru/viewtopic.php?pid=13006#p13006</id>
		</entry>
</feed>
